#louis-tam_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1235277079654830130
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! What is the CORS error you're seeing?
hi
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://checkout.stripe.com/c/pay/cs_test_b15yfs0oi4dCfd3vnURKb3ZKK2OXbRYRuxWgFUEn6R9mlZr4LeKD7mNzR0#fidkdWxOYHwnPyd1blpxYHZxWjA0SGJDUUFAPGdPX00wbmxUcH9QZ09NVU8yY2hUclZgb0x9UlxtMGhkUjNvPURGcmdmSX89YVZXc0hHVTZ9XHFHPUBQTEQwdFNfQWZcPExoZ0tQMV09dEBiNTVBYER1amJVaScpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPydocGlxbFpscWBoJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 403.
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://checkout.stripe.com/c/pay/cs_test_b15yfs0oi4dCfd3vnURKb3ZKK2OXbRYRuxWgFUEn6R9mlZr4LeKD7mNzR0#fidkdWxOYHwnPyd1blpxYHZxWjA0SGJDUUFAPGdPX00wbmxUcH9QZ09NVU8yY2hUclZgb0x9UlxtMGhkUjNvPURGcmdmSX89YVZXc0hHVTZ9XHFHPUBQTEQwdFNfQWZcPExoZ0tQMV09dEBiNTVBYER1amJVaScpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPydocGlxbFpscWBoJyknYGtkZ2lgVWlkZmBtamlhYHd2Jz9xd3BgeCUl. (Reason: CORS request did not succeed). Status code: (null).
Payment failed: TypeError: NetworkError when attempting to fetch resource.
Are you using the fetch() method to redirect to Checkout?
It sounds like you probably are
yes const response = await fetch(/api/stripe/create-checkout-session, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
I would recommend not using fetch() here, and instead use a regular HTML form submit that triggers a server-side function to create a Checkout Session. You can then use a 303 redirect on the server-side to redirect to the Session URL (see this guide for an example of how to do this: https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers).
Are there alternative ways to do this without reconfiguring everything as another form? I've got all my body data packaged and ready to go on a confirmation screen, which is where the create checkoutsession is