4

I am working with the relatively new Paypal REST api and have successfully been able to create billing plans, approve billing plans, get a list of my billing plans, create billing-agreements (subscriptions), execute billing-agreements, and find specific billing-agreements.

I would like to be able to retrieve (GET) a list of billing-agreements, similar to how I can get a lit of billing-plans. This is not shown in the documentation as being available. Does anyone know of a way of doing this? Since there is no webHook available for subscription cancellations (or any subscription events) and no way to get a list of agreements, this leaves developers with no efficient way to handle cancellations (especially since users can cancel via Paypal without visiting the site). My current method/plan to handle this is to loop through all subscriptions that I have stored in my MongoDB (I store them when they are executed successfully), and send a request to Paypal for that specific agreement. I check its 'state' and update my MongoDB if they don't match.

There must be a better way.

1 Answers1

2

I had the same problem, my first solution was almost identical to yours: I query the state of agreement upon user login and update the state in my db accordingly.

Later, I start to use IPN as my solution as suggested in this github comment by Tony: https://github.com/paypal/PayPal-Python-SDK/issues/69#issuecomment-69647946

hello_harry
  • 1,265
  • 2
  • 14
  • 24
  • 2
    This seems to be the best option at this point. The REST API still does not support GETting a list of billing-agreements, which puts developers in the position of using both the REST API and the IPN, which, in my opinion, makes no sense. PAYPAL, please add this basic functionality to the REST API. – TourneyManager Jun 25 '15 at 12:56