Linas
Linas

Reputation: 4408

Paypal, redirect user back to the same url he came from

I have pay now form on my page and after user finishes his payment i want him to return to the same url he came from, is that possible?

Maybe i need to use those Advanced variables for that?

Upvotes: 2

Views: 1210

Answers (2)

Jay Prall
Jay Prall

Reputation: 5465

Yes you need to pass the URL he came from to the paypal API return variable.

See the return variable in the paypal docs: HTML Variables for Displaying PayPal Checkout Pages

return (Optional)

The URL to which PayPal redirects buyers’ browser after they complete their payments. For example, specify a URL on your site that displays a “Thank you for your payment” page.

Default – PayPal redirects the browser to a PayPal webpage.

Upvotes: 3

Fabian
Fabian

Reputation: 3495

In PHP you could use $_SERVER["REQUEST_URI"] in a PayPal form as return URL like this:

<input type="hidden" name="return" value="http://www.yourdomain.tld<?php echo $_SERVER['REQUEST_URI']; ?>">

Upvotes: 2

Related Questions