#tonyp

1 messages · Page 1 of 1 (latest)

manic muralBOT
wild bone
#

Hi there!

#

Are the error having an impact on the integration?

swift trench
#

well the redirect isn't performed

wild bone
#

Can you share the code that is causing the issue, and the exact error message you see?

swift trench
#

exact same code as in the doc, but after the 302 I'm getting a CORS header « Access-Control-Allow-Origin » is missing

#

from https://billing.stripe.com/p/session/test_<sessionID>

#

May it be that I'm running on localhost ?

wild bone
#

Can you copy-paste your code here?

swift trench
#

`const portalSession = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: STRIPE_BILLING_PORTAL_SESSION_RETURN_URL
});

return res.redirect(portalSession.url)`

wild bone
#

This is your backend code. And how to you call that code from the frontend?

swift trench
#

through an axios post :
await axios.post(CREATE_PORTAL_ENPOINT, { userId })

meager valve
#

You cannot redirect an axios post request

#

You need to instead send the portalSession.url back to your client and do a client side redirect