#rishabhpanwar_error
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/1294392240231157912
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐ redirectToCheckout is deprecated and we typically recommend not using it anymore.
https://docs.stripe.com/js/deprecated/redirect_to_checkout
Instead we've seen better and more consistent behavior if the response from your server is a redirect to the URL for the Checkout Session.
Looking at the error though, is that encountered whenever you load Stripe.js or only if your code makes it to redirectToCheckout?
Its when I do:
const stripe = await loadStripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!);
Ah, gotcha, so it's when loading our script. Does your site currently use a COEP policy? Stripe.js currently doesn't have the necessary headers to work there if so.
Yes, I have this:
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
Yup, I'm pretty sure that's what is leading to this. Currently we don't return a crossorigin attribute or a CORP.
Let me try and remove this.
Yes this worked. Others who faced this before, did they remove this entirely or used some other setting?
Thanks!
Glad to hear that helped! I'm not exactly sure how others have handled this, or whether there is a less-strict policy that you can use rather than removing it completely.