#tongyuz.eth-checkout

1 messages · Page 1 of 1 (latest)

near ruin
#

you need to use event.preventDefault() in the JS code where you listen to the onsubmit event of your form and send your Axios request.

olive vine
#

And do I also need to use window.location.href = checkoutURL at frontend? Since the redirect function seems not working in golang.

near ruin
#

yep you can't redirect from an XMLHTTPRequest

#

so you would want your server to return something like a JSON object and extract the URL from there on the frontend and redirect to it as you say

olive vine
#

I see! Thanks! One more follow up question about react, is there a way to save the location.state so that if the customer want to go back to our site, the history can still remember their identities?

#

Now what I'm doing is to open a new tag for checkout so that they don't need to leave our site to pay. But I think it's not very intuitive.

near ruin
#

I'm not really familiar with that part unfortunately. It's the same as handling any other redirect from your site to a third party and then back.
You might want to add something like a URL query parameter to the success_url of the CheckoutSession so you can see that value when the user comes back, or use cookies