How do you unsubscribe from PayPal via their api?

On this page: Recurring payment processing

It says that you can unsubscribe from PayPal using your API. Knowing SubscriptionId can anyone give me some sample code on how to do this?

I am doing this manually at the moment, which is a pain (I log in to my PayPal account, find the subscription and cancel it).

I would like to automate this process basically.

+3
source share
2 answers

In perl, it could be something like this:

#!/usr/bin/perl use strict; use LWP::UserAgent; # Set values for $paypal_api_user, $paypal_api_pwd and # $paypal_api_signature from your paypal profile my $paypal_api_user = '....'; my $paypal_api_pwd = '.....'; my $paypal_api_signature = '.....'; # Set subscription id my $subscr_id = '....'; my $params = { 'USER' => $paypal_api_user, 'PWD' => $paypal_api_pwd, 'SIGNATURE' => $paypal_api_signature, 'VERSION' => '84.0', 'METHOD' => 'ManageRecurringPaymentsProfileStatus', 'PROFILEID' => $subscr_id, 'ACTION' => 'Cancel', }; my $ua = LWP::UserAgent->new(); my $res = $ua->post('https://api-3t.paypal.com/nvp', $params); if ($res->is_error()) { # HTTP error } else { # Success } 
+3
source

It depends on the type of subscription. If it starts with S-, it cannot be changed, although the API. If it starts with I-, he can.

Take a look at the ManageRecurringPaymentsProfileStatus API for this.
This allows you to send ACTION = Cancel, ACTION = Suspend, or ACTION = Reactivate.

+2
source

All Articles