views:

92

answers:

1

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?

+1  A: 

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://www.x.com/docs/DOC-1523

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

https://cms.paypal.com/cms_content/US/en_US/files/developer/IPNGuide.pdf

In particular, see chapters 2-4.

Finally, there's a whole host of discussion forums at http://www.x.com to help you out if you get stuck.

Owen S.