#Off_set
1 messages ยท Page 1 of 1 (latest)
Hello ๐
The error seems like a typical CORS error. How exactly are your creating the checkout sessions and handling the redirect?
On react, i run backend server with the IP of local:8080 and listened on it for stripe session post request, then on my front i used axios to call the backend directly to the ip of local:8080. Then ig theres a CORS error on the way from my origin local:3000 to local:8080
can you share the axios code that you're using to call your backend?
Trying to figure out if the CORS error occurs on your redirect to Checkout or is it just between your own servers
const createCheckoutSession = async () => {
const stripe = await stripePromise
const checkoutSession = await axios.post('http://localhost:8080', { items : items });
}
There is a button
<button onClick={createCheckoutSession{>Buy</button>
srry i write it on my phone, there maybe word mistake
You'd want to add some print statements in between your code to figure out if the error is thrown before your server-side code creates a checkout session or after it.
Right now, there isn't a way to tell what request is throwing this error.
i tried to import 'cors' as stackoverflow suggested, but it didnt work xd
Yeah sorry, there's just a lack of detail here unfortunately. Typically we see folks running into CORS when they're handling redirects to Checkout Session URL incorrectly
But at the moment, its unclear if you're running into the same issue here. So I'd recommend narrowing down on what code triggers this exactly by adding more print statements and seeing what breaks.
aight you can close the thread, have a good day
Good Luck ๐