« New Django Site: Samz Market and Gourmet Foods | Home | Custom Actions In Django Admin Object Editor »
PayPal IPN Python Code
By Paul Kenjora | October 2, 2008
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
- Joost Meets Django
- Digg For Django Is Here
- Django Generic Relations Made Easier
- Another IfModulo Template Tag Or If Else End Tutorial
- Digg Re-Written In Django With A Twist
Aware Labs Recommends
- Adding Google Friend Connect is an example of how hard it is to join the 2010 web (Robert Scoble Blog)
- An interview with Michael Trier (USwaretech)
- Exploring the 2010 Web (Robert Scoble Blog)
Topics: PayPal, Tutorial | Comments
-
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