PayPal auto return does not send back any POST data

Natalia picture Natalia · Dec 28, 2011 · Viewed 17.4k times · Source

I have a similar problem to this post

Setting PayPal return URL and making it auto return?

However, the solution there is not working. We have IPN set up and POST variables get passed back (the visitor clicks back and is able to download purchased PDF files) but then I tried to get rid of Paypal order confirmation page that says

you just completed your payment. Your transaction ID for this payment is: XXXXXXXXXXXXX.

and enabled "Auto Return" in Website Payment Preferences, specifying the URL http://www.educted.ca/payment_complete.php, the POST variables now do not get passed back to payment_complete.php - it shows blank. As soon as I disable "Auto Return", POST variables display properly and products purchased can be downloaded. I am using Paypal Sandbox account, of course.

<input type="hidden" name="return" value="<?php echo LIVE_SITE;>payment_complete.php">
<input type="hidden" name="cancel_return" value="<?php echo LIVE_SITE; ?>catalog.php">
<input type="hidden" name="notify_url" value="<?php echo LIVE_SITE; ?>ipn.php">
<input type="hidden" name="rm" value="2">

Any ideas?

Answer

Robert picture Robert · Dec 28, 2011

If you enable Auto Return, the values are always going to get returned via GET irrespective of what rm is set to.

If you want to do immediate file delivery after the buyer has completed the transaction, have a look at PayPal Payment Data Transfer. Once enabled, PDT adds a tx GET var to your return URL; by calling PayPal at https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx=value-for-tx-here&at=value-for-your-paypal-account-authentication-token you'll be able to pull in extra data about the transaction, and immediately check whether it's valid.
See also https://www.paypal.com/pdt/

IPN should be reserved for backend processing as it can come with a significant delay.
PDT, on the other hand, has you pulling the info from PayPal, and is as such immediate.