#nicolasbouteilleelephorm_93575

1 messages ยท Page 1 of 1 (latest)

pale cloakBOT
coral pawn
#

Hi, let me help you with this.

snow wolf
#

thank you ๐Ÿ™‚

coral pawn
#

Can you update your text after the customer clicks Submit, but before confirming the payment?

snow wolf
#

nope, the idea is to let them know the payment is confirmed

#

but from what I understand, "When you set something to window.location you are basically telling the browser to load the the specified url in the current window. When the browser does that all the code on the previous page ceases to operate" so it is too late for me to update my code

#

so I would need to do it just before Stripe JS redirects to return_url...

coral pawn
#

But if you're getting redirected, you don't see the previous page anymore. The page on return_url should provide them the status.

snow wolf
#

it takes a bit for this new page to load actually

#

so I want to make them wait but let them know the payment side is ok

coral pawn
#

We don't know if it's ok until we redirect.

#

The promise won't resolve before that. If you're redirected, it will resolve only if there's an error.

pale cloakBOT
snow wolf
#

yep that's what I figured so I wanted to know if you guys had a tip for me to plug in right before the redirect is done, but I guess this will be complicated

#

with onbeforeunload I can preventDefault but it show an alert to the user...

coral pawn
#

I am not sure I understand what's the problem to wait for the redirect.

mossy forum
#

๐Ÿ‘‹ taking over here

Are you only processing card payments or do you also have other non-card payment methods?
if you're only processing card payments then you can disable the redirect completely and control the behavior yourself

snow wolf
#

no I am implementing Payment Element and want to be able to add multiple payment solutions

mossy forum
#

I see. I do see this call out in the docs

Note: Setting if_required requires that you handle successful confirmations for redirect-based and non-redirect based payment methods separately. When a non-redirect based payment method is successfully confirmed, stripe.confirmPayment will resolve with a {paymentIntent} object.

snow wolf
#

this is the kind of text I want to display while waiting for the redirect to happen

mossy forum
#

yeah I don't think there's a workaround for this unfortunately since for redirect based payment method, the redirect happens automatically from intermediate page that authorizes the payment.

You could set return URL to your current URL, show the text and then trigger a manual redirect

snow wolf
#

ok thx for looking into it!