Search code examples
apipostpaypaldonationspaypal-webhooks

Can the PayPal API track inbound payments in real time?


I'm planning to create a web application that allows a user to track donation amounts to their PayPal account that are posting in real time towards a goal.

I need to know...

A. If it's possible B. If the path I'm using is the best path c. What is the best path is b isn't.

The flow would work like this.

1) User visits site and enters their PayPal Email address / password / goal donation amount. I'd then be able to make api calls on behalf of this user.

2) I'd use the API call and make a webhook on this users account for when donations come in (The webhooks only say it can fire when sales come in, but maybe donations count as a sale?)

3) I'd have a function on my website ready to accept the post data and update the tracker.

So if the tracker starts out saying 0/300 (user entered 300 for goal amount at the start), then a 15 dollar donation comes in it will update to 15/300, and if another donation for 5 dollars comes in it will say 20/300 etc...

Thanks for any suggestions / help!


Solution

  • Instead of using the user's PayPal email address and password, PayPal has something called a client id and client secret. These work like passwords to make API calls and allot safer than asking for the real email address and password from your user. If you revise your #1, then it is certainly possible to make API calls and receive webhooks just like you described.

    Link to PayPal Authentication & Headers: https://developer.paypal.com/docs/api/#authentication--headers

    Link to PayPal Notifications for managing webhooks: https://developer.paypal.com/docs/api/#notifications