gpt4 book ai didi

paypal - 如何在 PayPal Advanced 中创建定期配置文件

转载 作者:太空宇宙 更新时间:2023-11-03 16:33:57 25 4
gpt4 key购买 nike

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

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 advanced business account。所以我的问题是:

1) 我的代码是否与使用 Paypal 高级凭据的代码一样工作?2) 在 paypal advanced 中创建定期配置文件的步骤是否相同?我需要 Paypal 快速结帐和信用卡交易付款吗?

任何帮助将不胜感激。

提前致谢

最佳答案

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

关于paypal - 如何在 PayPal Advanced 中创建定期配置文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18186601/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com