【发布时间】:2011-04-18 02:21:42
【问题描述】:
您可以通过 API 取消 PayPal 自动付款吗?这是通过托管按钮创建的“订阅”。
我有“自动付款号码”和“交易 ID”。
【问题讨论】:
标签: paypal paypal-subscriptions
您可以通过 API 取消 PayPal 自动付款吗?这是通过托管按钮创建的“订阅”。
我有“自动付款号码”和“交易 ID”。
【问题讨论】:
标签: paypal paypal-subscriptions
是的。
您可以通过以下方式暂停或取消个人资料 使用 管理RecurringPaymentsProfileStatus API。您也可以重新激活一个 暂停的个人资料。如果最大 支付失败的次数已经 已达到,但是,您将需要 增加失败次数 在重新激活之前付款 个人资料。
请找this参考:
根据 PAYPAL,您可以使用 ManagerecurringPayments API 执行三个操作中的任何一个。
【讨论】:
我在找到解决方案之前找到了这个帖子,并认为我会回来给出答案。 (C#.Net 解决方案)
您将需要以下 nuget 包:
Install-Package RestApiSDK
Install-Package PayPalCoreSDK
Install-Package PayPalMerchantSDK
以及以下参考资料:
using PayPal.Api;
using PayPal.PayPalAPIInterfaceService;
using PayPal.PayPalAPIInterfaceService.Model;
代码如下:
public static void CancelRecurringPayment(string ProfileID)
{
ManageRecurringPaymentsProfileStatusRequestType request =
new ManageRecurringPaymentsProfileStatusRequestType();
ManageRecurringPaymentsProfileStatusRequestDetailsType details =
new ManageRecurringPaymentsProfileStatusRequestDetailsType();
request.ManageRecurringPaymentsProfileStatusRequestDetails = details;
details.ProfileID = ProfileID;
details.Action = StatusChangeActionType.CANCEL;
// Invoke the API
ManageRecurringPaymentsProfileStatusReq wrapper = new ManageRecurringPaymentsProfileStatusReq();
wrapper.ManageRecurringPaymentsProfileStatusRequest = request;
Dictionary<string, string> configurationMap = new Dictionary<string, string>();
configurationMap.Add("mode", "live");
// Signature Credential
configurationMap.Add("account1.apiUsername", "APIUSERNAME");
configurationMap.Add("account1.apiPassword", "APIPASSWORD");
configurationMap.Add("account1.apiSignature", "APISIGNATURE");
// Create the PayPalAPIInterfaceServiceService service object to make the API call
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);
ManageRecurringPaymentsProfileStatusResponseType manageProfileStatusResponse =
service.ManageRecurringPaymentsProfileStatus(wrapper);
// Check for API return status
Dictionary<string, string> responseParams = new Dictionary<string, string>();
responseParams.Add("API Status", manageProfileStatusResponse.Ack.ToString());
if (manageProfileStatusResponse.Ack.Equals(AckCodeType.FAILURE) || (manageProfileStatusResponse.Errors != null && manageProfileStatusResponse.Errors.Count > 0))
{
//FAILURE
Console.WriteLine(manageProfileStatusResponse.Errors.ToString());
}
else
{
//SUCCESS
Console.Write("Success!");
}
Console.WriteLine();
}
【讨论】:
“订阅是通过网站支付标准“订阅”按钮创建的。在 2009 年之前,订阅配置文件 ID 以 S-XXXXXXXX 开头。您无法通过任何 API 调用管理这些订阅。2009 年之后,订阅配置文件ID 以 I-XXXXXX 开头。您可以通过 ManageRecurringPaymentsProfileStatus API 调用取消这些订阅。"
遇到同样的问题,通过Robert 阅读即可,您可以使用 API 取消标准网站订阅。
【讨论】:
【讨论】:
我认为您不能使用 API 取消使用 Paypal 标准付款事件专业版的付款,而只能使用快速结帐。我尝试并收到错误消息:“定期付款 API 不支持订阅配置文件。”。您可以了解更多here。
【讨论】: