Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can someone show me the "hello world" of Paypal IPN?

I'd like to set up a PayPal donation box, and use their IPN protocol to monitor when donations come in. The documentation is enormously complex and full of features I'm not interested in. Is there a short snippet -- ideally in Python -- that shows how to, say, connect to Paypal, loop forever, and print "Just got $5" every time a donation comes in?

like image 712
mike Avatar asked Jul 02 '10 01:07

mike


1 Answers

Actually, with IPNs it's the other way around. PayPal posts a notification to your server via HTTP POST when a payment is made. You therefore need to make a CGI script or server that receives these posts, checks their validity, and processes them.

Probably the easiest sample code to look at for setting up an IPN processor is the PHP sample code at:

https://cms.paypal.com/cms_content/US/en_US/files/developer/IPN_PHP_41.txt

but there's a whole set of code snippets at:

https://github.com/paypal/ipn-code-samples

You shouldn't skip the official documentation because it covers how to administratively set up, and test, IPNs. It's at:

https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/ipnguide.pdf

In particular, see chapters 2-4.

like image 165
Owen S. Avatar answered Oct 20 '22 20:10

Owen S.