#ACEilla

1 messages · Page 1 of 1 (latest)

regal wingBOT
vivid sun
#

hello! do you have a URL which we can access to take a look at?

modern yacht
vivid sun
#

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?

modern yacht
#

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.

vivid sun
#

can you share your code snippets for how you're implementing the Stripe Checkout?

modern yacht
#

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 });

vivid sun
#

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

modern yacht
#

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.

vivid sun
#

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.

modern yacht
#

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.

vivid sun
#

can you explain more? what specifically didn't work?

modern yacht
#

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.

vivid sun
#

can you paste the code snippet where you're implementing window.location?

modern yacht
#

//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?

vivid sun
#

i'll get back to you in a bit

modern yacht
#

ok

vivid sun
#

oh oops, i think the actual function is window.location.href

modern yacht
#

Ok, I will try that.

#

Still experiencing the same behavior as before.

vivid sun
#

window.location.href(data?.url); this isn't how window.location.href is used. It's usually something like window.location.href = "someurl"

modern yacht
#

I see, I will try that and a few other things and let you know. Thank you

#

I got it to work.

vivid sun
#

great!

modern yacht
#

The .then() is getting its action from this:

#

Thank you very much for the help.