#jonas-siewertsen-_docs

1 messages ยท Page 1 of 1 (latest)

analog gobletBOT
#

๐Ÿ‘‹ 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.

ivory jay
#

Hi, let me help you with this.

#

I don't think there's a way to close it programmatically, unfortunately

bronze stump
#

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.

analog gobletBOT
ivory jay
#

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.

bronze stump
#

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.

ivory jay
ivory jay
#

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.

grand atlas
#

hi! I'm taking over this thread.

#

It's not possible to programatially close the modal.

bronze stump
#

I understand.

What alternative do I have to handle an upcoming error, if confirming the payment besides waiting for the timeout?

grand atlas
#

I think you can do something like .complete('fail')

bronze stump
#
// expressCheckoutElement.complete('fail');
// elements.getElement('expressCheckout').complete('fail');
// stripe.complete('fail');
// elements.complete('fail');

That does not seem to work.

grand atlas
#

maybe I'm confusing with the PaymentRequestButton, sorry.

bronze stump
#

No problem. I am thankful for every help, as I've been trying for quite some time now ๐Ÿ™‚

grand atlas
#

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.

bronze stump
#

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?

grand atlas
#

not sure to be honest, I've never tried this myself. thinnking about this...

bronze stump
#

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!

grand atlas
#

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?

bronze stump
#

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');
ivory jay
#

It's because you're trying to create a new element. What if you just mount it? I.e. delete the elements.create() call