#jared-green_code

1 messages ยท Page 1 of 1 (latest)

uncut troutBOT
#

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

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

sinful swan
#

Interesting, this error doesn't match the scenario. This error would occur if you selected a card payment without entering any details.

uncut troutBOT
sinful swan
#

It's possible that something is happening with the payment element where the Google Pay option is not being selected, could be something like re-rendering. Can you share more of the component code around the payment element?

analog temple
#

hi there, taking over for my colleague. do you see that error for any other payment method?

soft dragon
#

No, all the other payment methods work fine.

#

Google Pay also works fine if I am in the Chrome browser.

#

FYI: I have also tried updating the latest version of these Stripe libraries.
"@stripe/react-stripe-js": "3.9.0",
"@stripe/stripe-js": "7.8.0",

analog temple
#

ok, any console log errors you see when this occurs? also have you tried using other Android devices?

soft dragon
#

Let me check again, I don't remember any other console error messages. I only have this Google Pixel Pixel 9 test device. Not sure if Google Pay works in the emulator, I could check that.

analog temple
#

thanks, also if you could share the ID of a payment intent that is showing this error, that may be helpful

soft dragon
#

OK, let me see if I can find the payment intent ID...

soft dragon
#

We are getting the error before we create the payment intent. The error is in the response to the elements.submit(); function.

#

I did confirm that there are no other console log errors.

analog temple
#

can you share the code for the setPaymentDetailsFilled() function that you're calling on line 432? I'm wondering it that's somehow causing the checkout to re-initialize and default back to the card payment method

soft dragon
#

Sure, just a second...

#

const [paymentDetailsFilled, setPaymentDetailsFilled] = useState(false);

#

It is just a setter for a state variable. Let me see if there is anything listing for changes to this variable...

#

Yeah, it looks like paymentDetailsFilled is just used to know if we should show a message when the stripe element becomes ready but the user has not selected a payment method yet.

analog temple
soft dragon
#

Yes

#

I see this error message when I tap on the GPay button.
"Please check the following information and try again.
Email is required
"

analog temple
#

can you type a test email address into the field at the top and try again?

soft dragon
#

Yes

#

It appeared to work for me.

#

OK, so there is something about our implementation this is wrong. Do you have a link to the code that is running on this sample embedded checkout page?

analog temple
#

ok. so my theory of what's going on here is that React is causing a re-render of the payment method selection based on some side effect of a state change, causing it to default back to card. I would try removing as much of the state changes as you can (such as the ones in handleElementChange) and see if that solves the problem. then add back in to see if you can isolate what's causing this

#

you might also try adding logging around the rendering of the checkout to see if you can identify a place where the payment method type is getting changed

soft dragon
#

OK, sounds good. Thanks for your help.

analog temple
#

you're very welcome, good luck!