We have a web page which takes a Stripe payment, once the payment is complete Stripe can call a webhook on our server.
At this point, we can mark an Order as complete and complete any other additional tasks.
How can we have the order webpage update/move the user onto to order complete?
Should we consistently hit the server in AJAX to check if it's now complete, or is there a better way of doing this.
Most payment engines will redirect the payment session to a URL of your choosing with a result code or a different URL per result code. These can generally be configured at the moment the request is being made or for the entire site in a general configuration. These results should not be relied on for the actual payment as that is the job for the web hook. They can be trusted enough for your site to show a general success/fail error message and let the user continue doing whatever.
Stripe also allows for this, you can specify a
success_url(orsuccessUrlin the client integration).See Create a Checkout Session on your server for how to pass this URL to the request. You can also include a
cancel_url. See the last 2 parameters in the code sample below:See also Checkout Purchase Fulfillment.
And as I stated above do not rely on this as the actual indicator if the payment succeeded. You should use the web hooks for that.