php - PayPal auto return does not send back any POST data

703

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?

54

Answer

Solution:

If you enable Auto Return, the values are always going to get returned via GET irrespective of whatrm 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 atx 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.

997

Answer

Solution:

You can still keep Auto Return set to On, but make sure you DISABLE PDT, and you will get all the transaction variables sent to your return URL via POST (if you have the rm parameter set to 2 in your request of course, as you said you have).

For some reason, enabling PDT will ignore the rm parameter and force the GET method to be used.

897

Answer

Solution:

You can still keep Auto Return set to On, but make sure you DISABLE PDT, and you will get all the transaction variables sent to your return URL via POST (if you have the rm parameter set to 2 in your request of course, as you said you have).

This is the correct answer! You must not enable sending payment data with auto response, if you want get POST-Data.

BUT, in this case you have to use a https-site, otherwise the customer get a warning before redirecting!

570

Answer

Solution:

In your particular case, it was showing blank because of an error in your code:

<?php echo LIVE_SITE;>

That doesn't parse as valid PHP - it'd cause a fatal error. If no information has been output yet and error reporting is off, it'll be a blank page.

People are also looking for solutions to the problem: php - How can I check if a program is running in the background using a cron, and start it if needed?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.