#jared-green_code
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/1407363714549682288
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Interesting, this error doesn't match the scenario. This error would occur if you selected a card payment without entering any details.
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?
hi there, taking over for my colleague. do you see that error for any other payment method?
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",
ok, any console log errors you see when this occurs? also have you tried using other Android devices?
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.
thanks, also if you could share the ID of a payment intent that is showing this error, that may be helpful
OK, let me see if I can find the payment intent ID...
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.
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
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.
ok, can you try pointing your web view to the sample embedded checkout page here https://4242.io/test/checkout-embedded/ and see if you still see the error when trying google pay?
Yes
I see this error message when I tap on the GPay button.
"Please check the following information and try again.
Email is required
"
can you type a test email address into the field at the top and try again?
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?
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
the code can be found at the bottom of the page here https://4242.io/test/checkout-embedded/
OK, sounds good. Thanks for your help.
you're very welcome, good luck!