0

我已经使用贝宝网站付款标准实施了定期付款。我遵循的步骤是初始 SetExpressCheckout-> GetExpresscheckout->DoExpressCheckout->CreateReccuringPayments Profile。代码如下

public static PayPalRedirect ExpressCheckout()
    {
        NameValueCollection values = new NameValueCollection();

        values["METHOD"] = "SetExpressCheckout";
        values["RETURNURL"] = PayPalSettings.ReturnUrl;
        values["CANCELURL"] = PayPalSettings.CancelUrl;
        values["PAYMENTACTION"] = "Sale";
        values["CURRENCYCODE"] = "USD";
        values["BUTTONSOURCE"] = "XYZ";
        values["USER"] = PayPalSettings.Username;
        values["PWD"] = PayPalSettings.Password;
        values["SIGNATURE"] = PayPalSettings.Signature;
        values["SUBJECT"] = "";
        values["VERSION"] = "51.0";
        values["AMT"] = PayPalSettings.OrderAmount;
        values["L_BILLINGTYPE0"] = "RecurringPayments";
        values["L_BILLINGAGREEMENTDESCRIPTION0"] = "abcd";

        values = Submit(values);

        string ack = values["ACK"].ToLower();

        if (ack == "success" || ack == "successwithwarning")
        {
            return new PayPalRedirect
            {
                Token = values["TOKEN"],
                Url = String.Format("https://{0}/cgi-bin/webscr?cmd=_express-checkout&token={1}",
                   PayPalSettings.CgiDomain, values["TOKEN"])
            };
        }
        else
        {
            throw new Exception(values["L_LONGMESSAGE0"]);
        }
    }

OnSuccess 响应将命中我的成功 url。在那里,我使用以下代码创建了我的重复配置文件。

 public ActionResult Success(string token)
{
    bool isSuccess = false;
    GetExpressCheckout getExpressCheckout = new GetExpressCheckout();
    GetExpressCheckoutDetailsResponseType getExpressCheckoutResponse = getExpressCheckout.ECGetExpressCheckoutCode(token);

    if (getExpressCheckoutResponse.Ack == AckCodeType.Success)
    {
        ExpressCheckout expressCheckout = new ExpressCheckout();
        DoExpressCheckoutPaymentResponseType doExpressCheckoutResponse = expressCheckout.DoExpressCheckoutPayment
                                                    (
                                                        token,
                                                        getExpressCheckoutResponse.GetExpressCheckoutDetailsResponseDetails.PayerInfo.PayerID,
                                                        PayPalSettings.OrderAmount,
                                                        PaymentActionCodeType.Sale,
                                                        CurrencyCodeType.USD
                                                    );

        if (doExpressCheckoutResponse.Ack == AckCodeType.Success)
        {
            //create Recurring Payment Profile
            CreateRecurringPaymentsProfile createRecurringPaymentsProfile = new CreateRecurringPaymentsProfile();
            CreateRecurringPaymentsProfileResponseType recurringPaymentProfileResponse = createRecurringPaymentsProfile.CreateRecurringPaymentsProfileCode(
                                                                                            token,
                                                                                            doExpressCheckoutResponse.Timestamp.AddDays(7),
                                                                                            PayPalSettings.OrderAmount,
                                                                                            1,
                                                                                            BillingPeriodType.Week,
                                                                                            CurrencyCodeType.USD
                                                                                            );
            if (recurringPaymentProfileResponse.Ack == AckCodeType.Success)
            {
                //Transaction is successfull. 
                //insert record database
            }
        }
    }

   }

在沙盒环境中一切正常。当我搬家时,我的客户说这在实时模式下不起作用。所以在询问时据说他已经升级到 PayPal Advanced,而我在现场使用的 api 凭据是 paypal 高级商业帐户。所以我的问题是:

1) 我的代码是否与使用 paypal 高级凭据的代码相同?2) 在 paypal 高级中创建重复配置文件的步骤是否相同?我需要paypal express checkout和信用卡交易来付款吗?

任何帮助将不胜感激。

提前致谢

4

1 回答 1

1

步骤会略有不同。快速概述如下,您首先需要对 Payflow 端点进行 API 调用以生成您的安全令牌。这也是您传递参数的地方,这些参数表明您想要为 Express Checkout 设置定期付款。然后,一旦您取回令牌,您会将买家重定向到 Payflow 托管页面以完成付款。完成此操作后,您可以使用为客户创建的计费协议 ID 创建定期计费配置文件。

于 2013-08-12T15:45:48.583 回答