phppaypalpaypal-ipnreturnurl

Paypal return url with hash tag?


I've got a PayPal form which has return url with hashtag. When the payment is ready and the user press their link return to the page the link is with %23 insted #, is there a way to fix that? I need that hash tag to show the correct tab.

I know the question is a bit out of programming, and it may is a some PayPal api issue but maybe I'm doing something wrong.

For the protocol, I've tried with urlencode straight into my form, but the problem is still there, it seems that paypal encode that url and when is returned my browser can't decode it again.


Solution

  • Hashtag should work fine in the return url:

        <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" target="paypal" method="post">
        <input type="hidden" name="cmd" value="_xclick" />
        <input type="hidden" name="business" value="hbsawnhdglv@paypal.com" />
        <input type="hidden" name="item_name" value="item" />
        <input type="hidden" name="currency" value="USD" />
        <input type="hidden" name="amount" value="0" />
        <input type="hidden" name="return" value="http://localhost/test.php#test" />
        <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" />
        <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
        </form>
    

    and on jsfiddle. I also tried with ExpressCheckout and it works as well, however using standard anchors this may not work as the hashtag may be in the wrong place. Also, if you are trying to put it at the end of a GET variable it will think it is part of the variable and encode it:

        <input type="hidden" name="return" value="http://localhost/test.php?v=1#test" />
    

    Produces: http://localhost/test.php?v=1%23test