Paypal Woes – IPN and Return Method

I have been developing a Yii application for one of my clients and the payment module was supposed to use Paypal with IPN. While I agree that Paypal is the least developer friendly solution, there is wide demand for it in SMEs, which makes major share of my incoming projects so i have to live with it regardless of my personal preferences(Recurly and Stripe). Anyways, so i was working on this module and I hit a brick wall when no matter what I tried the return_url would always get POST data with details of payment from PayPal while rm was set to 1(same with rm=0  though). I could very easily ignore POST altogether and move onto working on remaining part of the module but with the level of curiosity I have it would have become difficult to sleep at night ;)

While investigating I found out that if you have IPN enabled in your account or if you are sending POST to PayPal with notify_url set, PayPal will make a POST request to return_url regardless of rm variable value sent by you. I couldn’t find an applause  explanation of why this is implemented this way but once I figured it out, I chose to incorporate the incoming POST data on return_url  and set rm to 2 to avoid confusion. Thanks to Damon Williams for mentioning this in his “Pro PayPal E-Commerce” book.

PS:
I tried to replicate same scenario in another app I did earlier and couldn’t even though the POST data sent to paypal is almost the same and both accounts have similar settings.

Tags: , , , , ,

Leave a Comment