PayPal IPN Python Code
PayPal has Instant Payment Notification (IPN) libraries with examples for Perl, Java, and even Ruby, but look as hard as I may none for Python. Then again I spent 2 years at PayPal as a senior developer, C++ and Java are the dominant languages. Django and Rails are not even on the radar (well I exaggerate a few people have vision). Point is I couldn’t find any clean and simple IPN code for my Django projects.
Yes, I know, I know…. There are other posts with source code for IPN. For example Google Code has an example. So does Django Snippets. Both are great examples but I don’t need a shopping cart or Google checkout, I just need PayPal IPN.
I decided to roll my own, after all I spent 2 years looking at the source code how tough could it be? Not tough at all actually, it just takes a while to dig through the documentation. Below is the source code for PayPal IPN. Its tested, and deployed on several projects.
The above code is the bare minimum required to correctly process an IPN request. Everything else you can setup through the PayPal sandbox. They even have a testing tool just for IPN within the sandbox.
Looking back on the code, I guess that PayPal does not have a Python/Django library or examples because its so simple. Once you have the IPN code above everything else is fairly straight forward. Assembling the purchase request, cart or single item, is not too difficult. You can do it using a simple HTML form. Encryption on the payment button is nice but IPN is even more secure so I would not spend too much time on the encrypt.
More from Aware Labs
- Everything A Django Developer Needs To Create Logins
- Goodbye WebFaction Django Hosting – A Reflection
- When Django Apps Grow Up
- Amazon EC2 Basics For The Curious
- Authenticating Using Email vs Username
Aware Labs Recommends
- Popularizing Django — Or Reusable apps considered harmful. (USwaretech)
- Django’s tipping point (Antonio Cangiano)
- An Interview with Jacob Kaplan-Moss – Creator of Django (USwaretech)
-
Sam
-
Sam
-
Jesper Taxbøl
-
pkenjora
-
raniologi
-
MMA Pound For Pound
-
built in gas grills
-
presa canario
-
Brian Neal
-
Guest
-
Craigslist Proxy
-
Guest
-
cprail
-
Adam Fisk
-
Chris
-
Michael Warkentin
-
sean

![Recommend [AwareLabs]](http://s3.amazonaws.com/arkayne-media/img/badge/logo-recommend-badge-medium.png)