#Lynexis-checkout

1 messages ยท Page 1 of 1 (latest)

dreamy sluice
#

Hello ๐Ÿ‘‹
Can you share the code that's creating a checkout session as well as the function that parses the response?

viral gale
#

Sure!

#

That is my call to my local stripe server

#

I'm using axios

#

This is my stripe checkout session api call

#

Pretty simple tbh, but the weird thing is that my res.data.url comes undefined

dreamy sluice
#

I'm using axios
I think that's the issue as your server-side code is attempting to redirect, not respond.
You either need to tell axios to follow that redirect OR an alternative would be to change the redirect to response and return the url as part of JSON object and manually setting window.location.href

#

to that URL

viral gale
#

Yeah in fact thats what I do, i use window.location.href(response.data.url) to redirect. I have done this before successfully before but I don't know why - response.data.url - comes as undefined this time

dreamy sluice
#

its the res.redirect
you probably want something like res.json({}) or res.send({})

#

don't remember off the top of my head

viral gale
#

Oh ok i'll give it a try

#

Yeah, it was the way to return the session.url

#

Just to make an observation to it in the Dev's documentation so people do not get this situation often

#

Thank you very much for your time!

dreamy sluice
#

NP! ๐Ÿ™‚ Actually in the docs we use a <form> in the example for this specific reason as forms can follow the redirect
axios and/or fetch can't

viral gale
#

My bad, I guess its my workflow issue haha, thanks!