This is a follow up question to: PHP: Easy way to start PayPal checkout?
So, my problem is that I am specifying the return url. However, after paying with PayPal, I end up at a a screen that says:
You just completed your payment. XXXX, you just completed your payment. Your transaction ID for this payment is: XXXXXXXXXXXXX.
We'll send a confirmation email to XX@XXXX.com. This transaction will appear on your statement as PAYPAL.
Go to PayPal account overview
I need it to not show this screen and go directly to the return URL. I have:
- Set the "return" variable
- Set the "rm" variable to: 2 (which according to the guide = "the buyer’s browser is redirected to the return URL by using the POST method, and all payment variables are included")
In fact, here's my whole form:
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="onlinestore@thegreekmerchant.com" name="business">
<!-- <input type="hidden" name="undefined_quantity" value="1" /> -->
<input type="hidden" value="Order at The Greek Merchant:<Br />Goldfish Flock BLG<br />" name="item_name">
<input type="hidden" value="NA" name="item_number">
<input type="hidden" value="22.16" name="amount">
<input type="hidden" value="5.17" name="shipping">
<input type="hidden" value="0" name="discount_amount">
<input type="hidden" value="0" name="no_shipping">
<input type="hidden" value="No comments" name="cn">
<input type="hidden" value="USD" name="currency_code">
<input type="hidden" value="http://XXX/XXX/XXX/paypal/return" name="return">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="11255XXX" name="invoice">
<input type="hidden" value="US" name="lc">
<input type="hidden" value="PP-BuyNowBF" name="bn">
<input type="submit" value="Place Order!" name="finalizeOrder" id="finalizeOrder" class="submitButton">
</form>
Any idea how I can get it to automatically go back? Alternatively, how do I get the result of the payment back to my website so I can update the database? What is IPN?
Sharing this as I've recently encountered issues similar to this thread
For a long time, my script worked well (basic payment form) and returned the POST variables to my success.php page and the IPN data as POST variables also. However, lately, I noticed the return page (success.php) was no longer receiving any POST vars. I tested in Sandbox and live and I'm pretty sure PayPal have changed something !
The notify_url still receives the correct IPN data allowing me to update DB, but I've not been able to display a success message on my return URL (success.php) page.
Despite trying many combinations to switch options on and off in PayPal website payment preferences and IPN, I've had to make some changes to my script to ensure I can still process a message. I've accomplished this by turning on PDT and Auto Return, after following this excellent guide.
Now it all works fine, but the only issue is the return URL contains all of the PDT variables which is ugly!
You may also find this helpful
Sample form using PHP for direct payments.
kindly go through the fields notify_url, return, cancel_return
sample code for handling ipn (my_ipn.php) which is requested by paypal after payment has been made.
For more information on creating a IPN, please refer to this link.
The below image will help you in understanding the paypal process.
For further reading refer to the following links;
hope this helps you..:)
on the checkout page, look for the 'cancel_return' hidden form element:
set the value of the cancel_return form element to the URL you wish to return to:
You have to enable auto return in your PayPal account, otherwise it will ignore the
return
field.From the documentation (updated to reflect new layout):
IPN is for instant payment notification. It will give you more reliable/useful information than what you'll get from auto-return.
Documentation for IPN is here: https://www.x.com/sites/default/files/ipnguide.pdf
Online Documentation for IPN: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
The general procedure is that you pass a
notify_url
parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.one way i have found:
try to insert this field into your generated form code:
rm means return method;
2 means (post)
Than after user purchases and returns to your site url, then that url gets the POST parameters as well
p.s. if using php, try to insert
var_dump($_POST);
in your return url(script),then make a test purchase and when you return back to your site you will see what variables are got on your url.I think that the idea of setting the Auto Return values as described above by Kevin is a bit strange!
Say, for example, that you have a number of websites that use the same PayPal account to handle your payments, or say that you have a number of sections in one website that perform different purchasing tasks, and require different return-addresses when the payment is completed. If I put a button on my page as described above in the 'Sample form using PHP for direct payments' section, you can see that there is a line there:
where you set the individual return value. Why does it have to be set generally, in the profile section as well?!?!
Also, because you can only set one value in the Profile Section, it means (AFAIK) that you cannot use the Auto Return on a site with multiple actions.
Comments please??