#Rémy
1 messages · Page 1 of 1 (latest)
Hello !
Of course thank you for creating
I don't have a great networking but i will try to upload picture
I hope these help you to find a solution 🙂
Are you trying to redirect your users to a Checkout Session URL?
That is we do here
We redirect users to a checkout session to register his payment method
You can see the url like https://checkout.stripe.com
How do you redirect users to the Checkout Session? Can you share your code?
Ah my apologise for the french in the picture ! Here is the part with the url
I'm in a train so excuse me for the delay
I will look for this
No worries!
What I'd like to know is how exactly you are doing the redirect. Is your backend server returning a URL and your frontend update the URL of the browser? Or is the backend directly returns a redirect response to the frontend? Or something else?
The backend redirect like you can see it on the picture.
In the front i get an endpoint payment/subscription who do the @Get('subscription') function in the back
i will try tu put allow-origin-access: '*' in my cors configuration and it was ok bu i can't allow every root because an error occured for other endpoint.
Your backend code looks correct. And what does your frontend code looks like? Do you make a GET request to your backend?
There are two main ways to do the Checkout redirection:
- Return the checkout.url from your backend, and then on the frontend update the
window.location - Or do a POST request (like <form action="xxx" method="POST">) on the frontend and then backend can do a
res.redirect()
can you show me an exemple for the first solution ? With the window.location ?
Here it looks like you are doing a GET request with res.redirect(), and I don't think that can work.
Ok we have do a middle solution...
can you show me an exemple for the first solution ? With the window.location ?
Your backend would return the checkout URL like this:res.json({url: session.url);And then your frontend does a GET request to get that URL, and updatewindow.locationto that URL to do the redirection.
And for the second one there is something to send with the post for the backend ?
In our doc we use the second option, and we don't pass anything in the POST: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout#redirect-customers
But I guess this depends on your integration.
Ok thank you i will try these solutions and i will tell you the result !