#ACEilla
1 messages · Page 1 of 1 (latest)
hello! do you have a URL which we can access to take a look at?
Hi Alex, https://atomicpomlabs.com
Web site created using create-react-app
it's working fine for me on safari
could be something specific to your device perhaps? Have you gotten a colleague to test it on their device instead?
I just tried it using Safari on my brothers iPhone and this is what happened.
Also, before he disabled the pop up block setting he didn’t get this dialogue box.
can you share your code snippets for how you're implementing the Stripe Checkout?
it sounds like you're performing a redirect with a new tab e.g. window.open(session.url, '_blank');
It's a known behaviour : https://melvingeorge.me/blog/open-new-tab-without-getting-blocked-by-browser-javascript
Yes, I am sending the stripe checkout session url from the back end to the front end and passing it into window.open(). Should I just do res.redirect() in the backend?
Or do I have to handle that res.redirect() response on my frontend somehow?
This is what I have in my backend currently for the response:
res.send({ url: session.url });
you can either do a redirect in the backend, or pass the url to your frontend and do a redirect there. The frontend redirect can be done using window.location
And in the frontend where I receive this response I have this line of code:
return window.open(data?.url);
"data" is what receives the response from the backend.
try using window.location instead. the problem that you're facing now is because you're trying to open it in a new tab without it being explicitly triggered by a customer.
Ok, I'll give that a try and let you know. Thank you.
Unfortunately window.location did not work that way I have it implemented.
can you explain more? what specifically didn't work?
When I clicked the "Confirm Payment" button to get redirected to the Stripe Checkout on my iPhone/Safari, nothing happened and the re-direct didn't happen.
can you paste the code snippet where you're implementing window.location?
//request
const { data } = await axios.post(${baseURL}/orders, {
orderItems,
shippingAddress,
totalPrice,
});
return window.location(data?.url);
Apologies for the poor formatting.
This snippet of code is within the try of a trycatch block, and the trycatch is within a redux asyncThunk.
Is this enough context?
i'll get back to you in a bit
ok
oh oops, i think the actual function is window.location.href
window.location.href(data?.url); this isn't how window.location.href is used. It's usually something like window.location.href = "someurl"
I see, I will try that and a few other things and let you know. Thank you
I got it to work.
great!