I've created a payment button in Paypal, and I'd like to pass a user's input as a variable to the thank you page. (domain.com/thank-you?uid=$ID
).
So I've added a <INPUT TYPE="hidden" NAME="return" value="domain.com/thank-you?" id="my-id">
according to the doc
and I've added an OnClick event to the submit button, submitElement.addEventListener("click", clickFunc, false);
And it is working nicely (tested it out with alert
& then implemnted the uid=$ID
addition to the hidden return
value). But PayPal does nothing with my return value. PayPal simply leaves the clients on their Successfully Paid
Page.
Any ideas? Thanks in advance, Have a great weekend!
When using HTML forms to redirect to PayPal, a return may never happen. Depending on the user's locale and funding method, PayPal may need to show them a receipt, and click a link to return. Or their browser may crash. If you require a return to happen, this is the wrong integration method.
The best integration method to receive a successful notification of completed payments is https://developer.paypal.com/demo/checkout/#/pattern/client, either that client-side-only version or the pattern that communicates with a server.
To use the server version, create two routes, one for 'Set Up Transaction' and one for 'Capture Transaction', documented here: https://developer.paypal.com/docs/checkout/reference/server-integration/
Either way, on successful capture you can display a thank you message in any way you wish. Including a redirect if you are feeling old-fashioned.