#tarantino-47_unexpected

1 messages ยท Page 1 of 1 (latest)

gloomy vergeBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

silver rune
radiant island
radiant island
#

Taking a look here

gloomy vergeBOT
radiant island
forest pilot
#

๐Ÿ‘‹ stepping in here as pgskc needs to step away

#

You can see that you did not pass captureMethod: 'manual' in the frontend so it defaults to automatic.

#

(It would be within the client_context hash of that request which shows your Elements options that you pass when initializing Elements)

#

So the mismatch leads to the error you are seeing.

silver rune
#

I see

#

I do this before a user clicks submit
elements.update({
captureMethod: isManualCapture ? 'manual' : 'automatic',
});

#

do I need to pass captureMethod anywhere else?

#

so I do elements.update() and then elements.submit()

#

and then stripe.createConfirmationToken({ elements })

forest pilot
#

That flow seems fine to me.... do you know if this error is only happening when wallets are used?

silver rune
#

it happens much frequently for google pay, yes

forest pilot
#

But you can't reproduce in test mode?

#

Ah wait wait I might know what is going on.

#

Yep okay

#

Unfortunately elements.update() is async here but does not return a promise.

#

I don't remember the particular reason elements.update() was not created async...

#

But you are running into a race condition here where elements.submit() is firing before the update ends.

#

So you are going to need to wait for that update-end Event before continuing here.

silver rune
#

oh, nice, glad that we figured it out

#

let me check the link

forest pilot
#

Whoops just realized I said elements.submit() is async when I meant to say elements.update() above. Edited it now.

silver rune
#

ok, nice, I'll try this solution, thank you!