25

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

我有“自动付款号码”和“交易 ID”。

4

5 回答 5

26

是的。

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

请找到参考:

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

  • 取消 - 只能取消处于活动或暂停状态的配置文件。
  • 暂停 - 只有处于活动状态的配置文件可以暂停。-
  • 重新激活 - 只能重新激活处于暂停状态的配置文件。--
于 2010-09-28T11:10:20.817 回答
5

我在找到解决方案之前找到了这个线程,并认为我会回来给出答案。(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();
}
于 2014-04-08T23:35:13.910 回答
3

“订阅是通过网站支付标准‘订阅’按钮创建的。在 2009 年之前,订阅配置文件 ID 以 S-XXXXXXXX 开头。您无法通过任何 API 调用管理这些订阅。2009 年之后,订阅配置文件 ID 以I-XXXXXX。您可以通过 ManageRecurringPaymentsProfileStatus API 调用取消这些订阅。”

遇到了同样的问题,Robert刚刚读过它,它可以工作,您可以使用 API 取消标准网站订阅。

于 2012-05-04T11:59:04.083 回答
1
于 2015-10-26T13:26:08.237 回答
0

我不认为您可以使用 API 取消使用 Paypal 标准付款事件专业版的付款,而只有快速结帐可以使用。我尝试并收到错误消息:“定期付款 API 不支持订阅配置文件。”。您可以在此处了解更多信息。

于 2013-01-29T07:32:55.623 回答