user1340557
user1340557

Reputation: 11

Using Dynamic URL for PayPal Redirect

I have an orders form, in which the following variables could be chosen: price, currency, quantity (+ others). The form is submitted through jquery: $("#paypal_form").submit();

Everything is fine and the transaction goes on normally, but in the end PayPal doesn't redirect to the specified URL in the form. Could you let me know what the correct setting for PayPal is, because in PayPal's options the only choice is to fill in a URL (otherwise it won't allow you to set the Auto Return setting), but my URL is dynamic and is changed based on the transaction ID. It looks something like this: <input type="hidden" name="return" value="myReturnUrl.php?OrderID=88273882717A72734">

Here is the form itself (fields are filled in with js):

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" id="paypal_form">
<p> 
<input type="hidden" name="cmd" value="_xclick" /> 
<input type="hidden" name="charset" value="utf-8" /> 
<input type="hidden" name="business" value="[email protected]" /> 
<input type="hidden" name="item_name" value="Citation Building" />
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="amount" value="" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="return" value="" /> 
<input type="hidden" name="cancel_return" value="id=0" />
<input type="hidden" name="bn" value="Business_BuyNow_WPS_SE" /> 
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit" alt="Buy Now" />

Thanks in advance.

Upvotes: 1

Views: 857

Answers (1)

Robert
Robert

Reputation: 19356

It's 'return' as you have it right now, but it needs to be an absolute URL. E.g.;

<input type="hidden" name="return" value="http://stackoverflow.com/questions/17970910/using-dynamic-url-for-paypal-redirect">

Upvotes: 1

Related Questions