Я нашел эту тему, прежде чем нашел решение, и подумал, что вернусь, чтобы дать ответ. (C # .Net Solution)
Вам потребуются следующие пакеты 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();
}