#acffaria91 - Checkout redirect
1 messages · Page 1 of 1 (latest)
Hello, do you have the ID of a Checkout Session that you created that this happened with?
Hi, yes: "cs_live_b1AiyJqaT3UweLt4xSkdGqiZ7mDZhLeu9VlUhY2tVULKb239C9oot3b47w"
And what is the URL that your user got redirected to instead of the one you provided?
I get a page with "cannot GET /pay/cs/..."
The thing is that because I'm on a POST method instead of replacing the url, the session url is added after my website's url
What POST method are you trying to replace the URL with?
Or are you saying you want a POST to happen as the redirect?
This is the post method to open the checkout page from stripe
when I press the button the page should appear, but instead of getting the checkout page I get an error
because it goes mywebsite.com/pay/cs/... instead of checkout.stripe.com/pay/cs...
Ah, have you checked your server's code for the create-checkout-session endpoint?
Oh wait that is that code
Still looking in to this, the URL on the Session object itself definitely has the checkout URL rather than the one for your site
yes, that part is correct
And does the browser try to redirect to the checkout.stripe.com URL initially and then redirect to your site or does it just go to your site?
I don't see a custom domain on your account which was my initial guess as to what might be happening. Trying to think of what else would do this.
yes, I don't have custom checkout, I can have the normal stripe checkout
on localhost everything is fine but I don't know why in live the first part of the url get's "lost"
any idea of what this could be?
Hello! Taking over and catching up...
Can you share both your frontend code that sends people to Checkout and a screenshot of what you're seeing that's unexpected?
The error is coming from your own server because you don't have a GET route handler set up for that URL, which makes sense because I don't think you would be expected to have a URL like that. Do you have any JavaScript that's intercepting the <form> submit and running custom code/logic? Or are you running anything like Turbolinks?
That is hard for me to answer, because I'm just re-doing the stripe checkout and the rest of the site was developed by someone else. There was some js that used to provide the info for the payments using the old api version, I added the form and the endpoint on the server. I made the click event that would unleash the other js commented
how can I have a get route handler for that url? I'm sorry, but I'm quite new to this
Can you search your code for preventDefault to see if you can find client-side JavaScript somewhere that's overriding the form submission?
I found one on a checkout page, I commented it but no change in the result
Is this online somewhere where I can take a look?
you press the button on the bottom of the page
I'm getting an error about not being logged in.
you can use my login: ana.faria@slefty.com pw: slefty
Looking now...
Alright, looks like something on your server is replacing https://checkout.stripe.com/ with https://www.ibasim.com/ in the Checkout Session's URL before redirecting to it. You can see in the creation request for the Checkout Session that the URL coming from Stripe is different: https://dashboard.stripe.com/logs/req_uDwYsZlkf61Dz0
Maybe there's some middleware or something doing that?
yes, I noticed in the logs it was good. I'm not able to discover what is making that change
It's something on your server for sure, and that's what's causing the problem.
I can't give you any more specific guidance than that, unfortunately.
do you think if I try to redirect on the client side it might solve it?
It could be a possible solution. You would need to change the server-side code to send the URL back to the client-side code instead of redirecting to it, then you can use window.location to navigate to that URL.
That's a bit more fragile than the current approach, but it's something a lot of people do.
No problem, good luck with it! If there's anything else we can do to help let us know!