#nicolasbouteilleelephorm_93575
1 messages ยท Page 1 of 1 (latest)
Hi, let me help you with this.
thank you ๐
Can you update your text after the customer clicks Submit, but before confirming the payment?
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...
But if you're getting redirected, you don't see the previous page anymore. The page on return_url should provide them the status.
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
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.
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...
I am not sure I understand what's the problem to wait for the redirect.
๐ 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
You can set redirect to if_required
https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-redirect
no I am implementing Payment Element and want to be able to add multiple payment solutions
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.
this is the kind of text I want to display while waiting for the redirect to happen
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
ok thx for looking into it!