2010-09-28 61 views

回答

26

是的。

您可以暫停或使用 ManageRecurringPaymentsProfileStatus API通過 取消輪廓。您也可以重新激活 暫停的配置文件。但是,如果已達到 失敗付款的最大數量 ,則在重新激活 配置文件之前,您將需要 來增加付款失敗 的數量。

請找this參考:

Accodring到PayPal,你可以採取任何的利用ManagerecurringPayments API三個動作。

  • 取消 - 僅在活動中的配置文件或 暫停狀態可以取消。
  • 掛起 - 只有在主動 狀態輪廓可以suspended.-
  • 重新激活 - 在 暫停狀態,可以重新激活.--
+3

這不只是爲 「貝寶的Pro /快速支付」? OP正在討論常規的PayPal訂閱系統。 – erikcw 2011-09-16 15:51:04

+1

爲我使用訂閱ID作爲配置文件ID。 – pat 2012-01-03 04:48:16

+1

您不能使用API​​取消舊訂閱,如下面答案中所述。 – 2012-08-24 11:14:15

3

「訂閱通過網站付款標準只能創建配置文件'訂閱'按鈕在2009年之前,訂閱配置文件ID以S-XXXXXXXX開頭,您無法通過任何API調用管理這些訂閱,2009年之後,訂閱配置文件ID以I-XXXXXX開頭,您可以取消通過ManageRecurringPaymentsProfileStatus API調用訂閱。「

如果遇到同樣的問題,只能通過Robert來閱讀它,它可以工作,您可以使用API​​取消標準網站訂閱。

+0

什麼工作?我有同樣的問題,我不能取消S-訂閱。 – Tomas 2012-08-22 07:14:54

+2

是的,你將無法使用API​​取消「S」的前綴訂閱。 – 2012-08-24 11:06:32

+0

如何使用I-前綴創建訂閱? – Tomas 2012-08-24 11:08:13

0

我不認爲你可以使用API​​來取消支付與貝寶標準支付事件專業人士,而只有快速結賬將工作。我試過並得到錯誤消息:「定期支付API不支持訂閱配置文件」。你可以找到更多here

+0

努力中檢索訂閱的詳細信息時,您將只能得到這個錯誤。 ''任何''訂閱都可以進行狀態編輯。 – gunwin 2014-04-08 23:37:19

5

在找到解決方案之前,我發現此線程,並認爲我會回來給出答案。 (C#。網絡解決方案)

您將需要以下的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(); 
} 
+1

您的代碼非常好,並且重點突出。它幫助我解決了我的問題。謝謝。 – Sunil 2016-05-24 19:45:28