#Lynexis-checkout
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Can you share the code that's creating a checkout session as well as the function that parses the response?
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
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 settingwindow.location.href
to that URL
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
its the res.redirect
you probably want something like res.json({}) or res.send({})
don't remember off the top of my head
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!
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
My bad, I guess its my workflow issue haha, thanks!