by Njål

Cancelling old S-* PayPal Subscriptions from code

2015-10-26_1408

PayPal does not support cancelling old S-* subscriptions from code/api’s. This means that either you (as a merchant) or the customer has to log in to PayPal’s API and cancel these subscriptions manually. #Pain.

Luckily – it can be automated using Phantom.js. Phantom.js is basically a rock solid webbrowser without a UI which you can program (JS) to do stuff for you. I have made a PayPal.js script which lets you input Email, Password and the old S- SubscriptionID you want to cancel.

Here’s how to use it:

  1. Download Phantom.js (2.0.0) – and Unpack it to a new folder – http://phantomjs.org
  2. Download PayPal.js and place it in the same folder
  3. Run phantomjs.exe –ssl-protocol=any paypal.js paypalemail@gmail.com MySecretPass S-123455634545234
  4. While it’s running – keep an eye on the folder. PNG screenshots will appear there providing you a peepshow of the progress.
  5. When done – your website will receive a IPN Callback from PayPal.