PayPal return URL

16,705

Solution 1

I've decided to go about it a different way.

I realized that you can tell PayPal to send back all of it's queries via POST, so I'll add some POST checks to my PHP and it should work fine.

Thank you for the responses.

Solution 2

I remember reading in their docs that you can add a new hidden field with any custom value, that will be posted back to you.

You could use that field for whatever you want - I don't recall from memory how it was called, though, sorry, but if you have the docs at hand you'll find it pretty easily.

Solution 3

Adding

<input type="hidden" name="rm" value="2" /> 

works too

Solution 4

Why not just encode it in the name of the file:

http://www.mysite.com/ppreturn/2938

And then use mod_rewrite to turn it into a query string:

RewriteRule ^/ppreturn/([1-9]+[0-9]*)  /ppreturn/myscript.php?prodid=$1

If paypal adds querystring data to your url (always) then you can use mod_rewrite to add it to the end.

A full mod_rewrite tutorial is a bit out of scope, but the Interwebs are full of info. Start with the Apache docs. There is also a comparable system for IIS.

edit

I'm commenting 2 years later but, my answer is BAD. The accepted answer is best. GET requests shouldn't in theory mutate state, especially when it is something like payments

Solution 5

As far as I know, you can't return vars in the paypal return link. Paypals biggest drawback and I've no idea why they don't let you.

I've always got round it by storing vars in cookies - its by no means an ideal solution though.

There may be more option in PayPal Pro though?

Share:
16,705
Sam
Author by

Sam

I am a 29 year old Web Developer from North Devon, England.

Updated on June 04, 2022

Comments

  • Sam
    Sam about 2 years

    Here's the code for my Paypal button:

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="[email protected]">
        <input type="hidden" name="lc" value="GB">
        <input type="hidden" name="button_subtype" value="products">
        <input type="hidden" name="no_note" value="1">
        <input type="hidden" name="no_shipping" value="1">
        <input type="hidden" name="rm" value="0">
        <input type="hidden" name="return" value="http://www.example.com">
        <input type="hidden" name="item_name" value="My Item">
        <input type="hidden" name="amount" value="25.00">
        <input type="hidden" name="currency_code" value="GBP">
        <input type="hidden" name="bn" value="PP-BuyNowBF:proceed_btn.gif:NonHosted">
        <input type="hidden" name="item_number" value="4BD9569402CDE">
        <input type="image" src="http://www.example.com/image.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
        <img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
    </form>
    

    Is it possible to add the item_number to the return URL?

    For example, after completing the payment within PayPal the user gets sent back to http://www.example.com?item_number=4BD9569402CDE