PayPal – Generic PHP Payment (PDT/IPN) Script
by Kristian Kraljic
To quote the refrain of one of my favorite songs: I’m “Still Alive”. My fourth publication took again a little longer than expected. I had to finish a lot of things at work, unfortunately nothing which I can publish here (yet).
Today I want to introduce my generic PayPal PDT (Payment Data Transfer) and IPN (Instant Payment Notification) script. I have been using it for quite a while now personally, so I thought: “Why not put some more effort into it and release it for everybody”. Using the merchant services of PayPal has been kind of tricky in the past. If you handle your transactions manually you are good to go, but as soon as you start to process your payments automatically, you have no other chance as to integrate either your own PDT and/or IPN script to handle the transactions.
There are a lot of examples of implementing a proper IPN or PDT script, but this script is a more general solution for all PayPal szenarios using PDT and/or IPN. The script automatically:
- Records & validates the transactions
- Extracts necesarry information and writes it to the database
- Notifies you via e-mail if a transaction has been processed
- Provides possibilites to enhance the script to write your own “transaction handler” functions
The script works out of the box and is able to deal with PDT and IPN requests. Simply follow the instructions in the readme file to customize your database connection and contact e-mail. Also a explanation is given how to customize your PayPal account for using the PDT and/or IPN szenarios.
Download Source: (Distributed under the Simplified BSD License)
- Version 1.2: Download
If you have anything to say, suggestions or questions feel free to drop a comment below.
Update (10.17.11): Version 1.1 released. Please update your scripts. A bug was fixed if a ‘pending’ transaction comes in.
Update (03.18.11): Version 1.2 released. Please update your scripts. A bug was fixed for transactions not in sandbox.