#ohdeedeeoh

1 messages · Page 1 of 1 (latest)

heady quarryBOT
#

Hello ohdeedeeoh, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
ohdeedeeoh, 7 hours ago, 2 messages

drowsy snow
#

redirect to stripe portal failed because of CORs, is there a section in stripe web app for me to configure CORs policy to allow my localhost and prod to talk to stripe apis?

redirected from 'http://localhost:3000/api/payments/nodes/5073478b-6fe4-423e-abbd-07957a96f9bb/checkout') from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

My server coderes.redirect(303, session.url)

faint stream
#

hello, can you share your client side code?

#

i.e. are you using a fetch request to the endpoint that creates the Checkout Session? or via some other method?

drowsy snow
#

Yes, use fetch, but I am using next 13, not sure they polyfilled or patch the fetch, or not, and I don't want to use form

#
const response = await fetch(`url`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(body),
  });
if (!resonse.ok) throw 'error'
return null
faint stream
#

you'll want to redirect from the frontend instead then to solve that problem

#

return the session.url as part of the response, then redirect from your frontend

drowsy snow
#

That would work, I just want to know how I could use redirect from backend, is there any other way, I just want to know that's all

faint stream
#

i don't really think there's any other great alternative for redirecting via your backend. redirecting from your frontend is the best solution