#moony

1 messages · Page 1 of 1 (latest)

mellow hullBOT
pallid idol
#

hey there unfortunately you can't redirect the Axios post request

#

instead you can return that session URL back to the client and then redirect client side

#

using for example window.location or the appropriate redirect mechanism for your framework

prisma linden
#

Hey there, thank's for your answer but could you maybe give me a quick small example?

pallid idol
#

SUre, where you have res.redirect(303, session.url); you could instead do eg res.send({ url: session.url });

prisma linden
#

Okay, will try, thank's! 🙂

pallid idol
#

then in the client you're receive that and use something like window.location.href = url

prisma linden
#

thank you

pallid idol
#

NP!

prisma linden
#

Sorry, one more question. Should it look like this then? res.send({ url: '/api/checkout_sessions'}); and the window.location.href = '/api/checkout_sessions' ?

pallid idol
#

No, the url is unique for each session after you create it -- its the same session.url you were initially redirecting to

prisma linden
#

ok