#kkkkkkkkkkkkkkkkkkkkkd-checkout
1 messages · Page 1 of 1 (latest)
that just means you're doing the redirect incorrectly
can you share
- the backend code that creates the CheckoutSession and returns information to the frontend
- the frontend code that calls the backend and tries to do the redirect
so I can have a look?
I don't have it readily available. I'd have to check back in with you later. Any general advice on what to look for & then correct on my end?
yep
so usually this happens because your backend tries to do a 303 redirect return
but your frontend is calling the backend function through a XMLHttpRequest/Fetch/Ajax etc
which doesn't work, you can't redirect from an XMLHttpRequest.
so instead you should either
- change the backend to return a 200 with some response body(like a JSON object that contains the the
urlfield of the CheckoutSession) and on the frontend, extract that and setwindow.location = response.urlfor example to do the redirect that way - change the frontend so you call the backend from e.g. a
<form action="create-checkout-session">instead of a XHR.