#jonas-siewertsen-_docs
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1346434863300870177
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, let me help you with this.
I don't think there's a way to close it programmatically, unfortunately
Is there a way to show a custom error in the UI as alternative?
I need a solution to handle an upcoming error. Otherwise I need to wait for the timeout, which is not a nice user experience.
You can't show a custom error in the wallet modal, unfortunately.
Perhaps you could throw an error in the handler?
Alternatively, you could unmount and mount the element again.
Can you go more into detail on how to trhow an error in the handler? What's the expected result?
I thought about unmounting, but in that case inputs are lost.
Maybe you could try updating the element, which might cause the modal to close: https://docs.stripe.com/js/elements_object/update_express_checkout_element
I'll try
I am just throwing in ideas, since I am not aware of a straightforward way to close it programmatically. I would suggest testing it yourself.
hi! I'm taking over this thread.
It's not possible to programatially close the modal.
I understand.
What alternative do I have to handle an upcoming error, if confirming the payment besides waiting for the timeout?
I think you can do something like .complete('fail')
// expressCheckoutElement.complete('fail');
// elements.getElement('expressCheckout').complete('fail');
// stripe.complete('fail');
// elements.complete('fail');
That does not seem to work.
maybe I'm confusing with the PaymentRequestButton, sorry.
No problem. I am thankful for every help, as I've been trying for quite some time now ๐
unfortunately I don't see a way to handle this, except what was suggested earlier:
Perhaps you could throw an error in the handler?
Alternatively, you could unmount and mount the element again.
The unmount and mount is my last ressourt which i will try.
Can you explain on how to throw an error in the handler? What do you mean? What would be the benefit?
not sure to be honest, I've never tried this myself. thinnking about this...
I am using unmount, as this seems to be the only way to close the modal.
After that, I cannot mount the element again. So to retry the payment, a page refresh is required.
This is definitly not the user journey I have hoped for.
As Feedback I would return, that I would hope for a way to cancel the confirmation process manually in a express checkout flow in the future.
Thanks for your help!
After that, I cannot mount the element again.
that doesn't sound right. what happens when you try to mount the element again? do you get an error? if so, which one?
Uncaught (in promise) IntegrationError: Can only create one Element of type expressCheckout.
I am doing something like this.
expressCheckoutElement.unmount();
const newExpressCheckoutElement = elements.create('expressCheckout', {
layout: {
// maxColumns: 3,
overflow: 'never',
},
});
newExpressCheckoutElement.mount('#express-checkout-element');
It's because you're trying to create a new element. What if you just mount it? I.e. delete the elements.create() call