#Charmon
1 messages · Page 1 of 1 (latest)
Hello, are you using redirectToCheckout on the client side to redirect your users to the checkout page?
This usually happens if you us stripeAccount server side when creating the Checkout Sessions but don't use it when initializing stripe.js client side
To mitigate it, we typically recommend doing away with redirectToCheckout altogether. You can just do a server side 303 redirect to the checkout session's URL, or send the URL client side and do a normal javascript redirect
one sec
const stripe = await getStripe();
stripe?.redirectToCheckout({ sessionId });
what would I need to change
My second and third message there are what you would need to change
This usually happens if you us stripeAccount server side when creating the Checkout Sessions but don't use it when initializing stripe.js client side
To mitigate it, we typically recommend doing away with redirectToCheckout altogether. You can just do a server side 303 redirect to the checkout session's URL, or send the URL client side and do a normal javascript redirect
So either you can change your stripe.js code to properly include the stripe account parameter when initializing:
Or you would change your server side code to do a 303 HTTP redirect
what is "doing away with redirectToCheckout "?
A colloquial way of saying you can remove redirectToCheckout from your code and redirect using another method like the ones I listed
oh ok
so 303 http redirect is done server side?
which generates url
and returns to the client
The URL is part of the checkout session object https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So you will get that back in the response when your server makes the request to create the new Checkout Session
ok, so the url will be under session.url?
Correct
and then I would use that url on the client with window.location.replace()? or how does that 303 redirect work?
Yes you can definitely use that URL with window.location.replace()
The 303 redirect would depend on what you use server side. If you search your server framework and "303 redirect" there will likely be a good doc on it
Ok, thanks I will check