Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal rest API billing agreements webhooks

So I am integrating the Paypal Rest API with my django site so I can introduce subscription based billing, so far everything is going great.

I have a interface for Billing plans, Billing agreements, Transaction history and everything to create and activate billing agreements ect.

However I need a way to be notified if a billing agreement is cancelled or a payment is made for a billing agreement so I though webhooks would be the way to go for this however I am not 100% sure that webhooks work for billing agreements?

Can anyone suggest a way I can track payments made for billing agreements or another method?

like image 979
Sam Buckingham Avatar asked Oct 14 '14 01:10

Sam Buckingham


2 Answers

I can confirm that when a recurring payment is executed, one is notified via webhook event PAYMENT.SALE.COMPLETED as described here: https://github.com/paypal/PayPal-Python-SDK/issues/132#issuecomment-261374087

JSON structure of the webhook event:

{
    ...
    "resource": {
        ...
        "billing_agreement_id": "I-38097XVV6XVU"
        ...
    }
    ...
}

A list of all event names can be found here: https://developer.paypal.com/docs/integration/direct/webhooks/event-names/

like image 143
Ned Avatar answered Sep 19 '22 14:09

Ned


This might not be covered by paypal's webhooks notification. You can try it on sandbox and see if you get webhooks notification. Or you can use IPN, you should be able to get IPN notifications.

like image 40
Alex Avatar answered Sep 19 '22 14:09

Alex