Zac*_*urt 25 paypal paypal-subscriptions
您可以通过API取消PayPal自动付款吗?这是通过"托管"按钮创建的"订阅".
我有"自动付款号码"和"交易ID".
Mic*_*ins 26
是.
您可以使用ManageRecurringPaymentsProfileStatus API暂停或取消配置文件 .您还可以重新激活暂停的个人资料.但是,如果已达到最大失败付款数,则需要在重新激活配置文件之前增加失败付款的数量.
请找到这个参考:
根据PAYPAL,您可以使用ManagerecurringPayments API执行三项操作中的任何一项.
在找到解决方案之前我找到了这个帖子,并且认为我会回来给出答案.(C#.Net解决方案)
您将需要以下nuget包:
Install-Package RestApiSDK
Install-Package PayPalCoreSDK
Install-Package PayPalMerchantSDK
Run Code Online (Sandbox Code Playgroud)
以下参考文献:
using PayPal.Api;
using PayPal.PayPalAPIInterfaceService;
using PayPal.PayPalAPIInterfaceService.Model;
Run Code Online (Sandbox Code Playgroud)
这是代码:
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();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21479 次 |
| 最近记录: |