PayPal Payment Notification Information (OpenInsight 32-bit)
At 02 OCT 2012 08:10:51AM Harold King wrote:
What would be the best way to receive live transaction information after an O4W “Buy Now” call to PayPal?
I’ve tested the “Buy Now” functionality using O4W and it works great! The next important piece is to be able to gather the (live) transaction information from PayPal and do something with it.
I’ve written an OI program to constantly poll for payment notification emails from PayPal. The program reads the Payment Notification Email sent from PayPal and extracts the transaction info (Customer Name, Item#, etc.). There are some pitfalls: 1. Some characters are converted in the email (looks like encoding). 2. What happens if PayPal changes the format of the email?
A better way would be if PayPal could send out live transaction information in a fixed data format. After investigating I found they do have a thing called IPN (Instant Payment Notification). Is there a way to have an O4W program interface with PayPal’s IPN? This would be awesome!
Thanks,
Harold
At 30 OCT 2012 10:27PM Aaron Thorp wrote:
The IPN Will send a request to the allocated web page in the PayPal settings with the details of the transaction with fields in the POST section of the header, so you can extract items out with a simple extraction of the querystring. An example of IPN posted data is below: (This is a real IPN transaction with the names and addresses replaced)
&mc_gross=15.00&protection_eligibility=Ineligible&payer_id=W4A799TAXH7V6&tax=0.00&payment_date=23%3A53%3A07+Mar+27%2C+2012+PDT&payment_status=Completed&charset=windows-1252&first_name=Bob&option_selection1=bobmarley123&mc_fee=0.66¬ify_version=3.4&custom=&payer_status=verified&[email protected]&quantity=1&verify_sign=A9LC3Qajo-H2V8mPq4eIktgPvG2RAcLw7LB3cNJG20YYcM2Xv4oFVjah&[email protected]&option_name1=username&txn_id=7L093703HK162654P&payment_type=instant&btn_id=37908334&last_name=Marley&[email protected]&payment_fee=&shipping_discount=0.00&insurance_amount=0.00&receiver_id=YPSJ493W2FX9S&txn_type=web_accept&item_name=%2415+Item&discount=0.00&mc_currency=AUD&item_number=15item&residence_country=AU&handling_amount=0.00&shipping_method=Default&transaction_subject=%2415+Bid+Pack&payment_gross=&shipping=0.00&ipn_track_id=79d352d4149c6There is also details on the PayPal developers site with code samples on how to post back the information to the PayPal secure server to verify that the IPN transaction was a vaild one. The code is in PHP etc, but should be easily able to be converted into a Javascript code and then called within OI to parse it and verify it…
Aaron Thorp
THiNK Software