您可以通过API取消PayPal自动付款吗?(通过托管按钮创建订阅)

Zac*_*urt 25 paypal paypal-subscriptions

您可以通过API取消PayPal自动付款吗?这是通过"托管"按钮创建的"订阅".

我有"自动付款号码"和"交易ID".

Mic*_*ins 26

是.

您可以使用ManageRecurringPaymentsProfileStatus API暂停或取消配置文件 .您还可以重新激活暂停的个人资料.但是,如果已达到最大失败付款数,则需要在重新激活配置文件之前增加失败付款的数量.

请找到这个参考:

根据PAYPAL,您可以使用ManagerecurringPayments API执行三项操作中的任何一项.

  • 取消 - 只能取消处于活动或暂停状态的配置文件.
  • 暂停 - 只能暂停处于活动状态的配置文件.-
  • 重新激活 - 只能重新激活处于暂停状态的配置文件.--

  • 这不仅仅是"Paypal Pro/Express付款"吗?OP正在谈论常规的paypal订阅系统. (3认同)

gun*_*win 5

在找到解决方案之前我找到了这个帖子,并且认为我会回来给出答案.(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)