#kgeark_applepay-nextjs
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/1433477161259372736
๐ 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.
- kgeark_googlepay-debug, 1 day ago, 18 messages
- kgeark_error, 2 days ago, 41 messages
In addition to what I wrote above we have also used https://4242.io/test/payment-request-button/ to test also and got a successful test
Adding @sly birch who is the lead developer on this issue and @unreal elm who is the FE manager to help add more context
Hi there ๐ if googlePay is coming back false, that means we aren't detecting that Google Pay is set up on the device/browser the customer is using.
Have you already found and gone through this list to ensure the device/browser is set up correctly?
Hm, actually, if you see googlePay as true on our test page, but not on yours, then it's likely something with your page. Do you have another payment integration running on it? I've seen weird behavior when multiple integrations are competing to use the GPay flows.
No stripe pay is the only processor this site uses - so we are using the stripe SDK
Do you have a publicly accessible test page?
I can send you the URL for the page that was reported - this only happens for some users - when we were testing like I said - the test page said true but then this site wouldnt load the button - here is the page https://www.thewildrooster.co/checkout
Online Ordering
Wondering if there is something we are possibly missing when calling stripe or the pay.js
Pay.js, that's the GPay script, right?
correct
Hm, GPay is loading fine for me so far (assuming I'm looking at the right spot, I see it in more than one place)
Oh, I see, you render the GPay button conditionally based on the radio button?
Correct - by default we try to render the gpay button - if it fails to load we then default to card - which is the weird thing checking all the browser settings and testing on the test page successfully but then intermittently on this page the gpay button wont load
Is it actually intermittent, or is it test user/device dependent?
Have you checked to make sure you aren't running into the common blockers? https://docs.stripe.com/testing/wallets?ui=payment-request-button-element#device-requirements
Thanks for sharing this Im taking a look now - the report from our customers and the testing we have done its intermittent
Looking at that document we have checked all of these and are not running into them - Im wondering why the test page works but the site doesnt always - Could it possibly be we are tring to render the button before the pay.js call finishes? Or loads? Hve you seen that before?
๐ stepping in here as toby needs to step away
Catching up
Can you share your relevant code here?
May be hard for me to help much if we can't reproduce at all.
But maybe there is more logging we can add to get more signal.
Give me just a moment here to get you what you need - thank you - I agree the lack of being able to reproduce for some has made this challenging
I have asked our lead developer @sly birch to jump in and help give the relevant code - he should be helping on this shortly
Sounds good no rush
Getting caught up
We are using next js and this is how we are using stripe to check if digital wallets is available
`// Initialize stripe payment only once
useEffect(() => {
async function checkPaymentSupport(stripePaymentRequest: PaymentRequest) {
const [canMakePaymentResult, error] = await tryCatch(stripePaymentRequest.canMakePayment());
if (error) {
ErrorReporter.captureMessage(
'Stripe / Digital Wallet payment failed to initialize.',
'warning',
{ error: JSON.stringify(error) },
);
hasInitializedRef.current = false;
throw new Error('Stripe / Digital Wallet payment failed to initialize.');
}
const wallet = getDigitalWalletType(canMakePaymentResult);
if (!wallet) {
dispatch(paymentActions.digitalWalletWarningSet(true));
return;
}
setDigitalWalletType(wallet);
stripePaymentRequest.on('token', (event) => onSubmitTokenization(event, wallet));
stripePaymentRequest.on('cancel', () => {
submittingRef.current = false;
});
setPaymentRequest(stripePaymentRequest);
}
if (
stripe &&
!paymentRequest &&
isDigitalWalletSelected &&
!hasInitializedRef.current &&
supportsStripePayment
) {
hasInitializedRef.current = true;
void checkPaymentSupport(stripe.paymentRequest(getOptions()));
}
}, [
stripe,
paymentRequest,
isDigitalWalletSelected,
getOptions,
onSubmitTokenization,
supportsStripePayment,
dispatch,
]);`
On logging canMakePaymentResult we get the following { "applePay": false, "googlePay": false, "link": true }
Wait you are seeing googlePay: false but expecting the button to render?
We are getting googlePay: false when we should be getting googlePay: true
Im not testing it myself, but we have an internal user experiencing the issue. We know the card is valid because we can complete google pay orders on other sites
Hi there, yes the user with the issue on our site can load the google pay button on other sites
Are those other sites on Stripe? What happens when they go to https://docs.stripe.com/elements/express-checkout-element/accept-a-payment -- does it load there?
Overall this seems like something unique to this customer's card...
Yes the other sites are on Stripe
We will verify what happens if they visit the above link and get back to you
Okay yeah that would be a good next step. I'm doing some digging to see if anything like this has come up before that would be a clue.
But it doesn't seem like a code/integration issue afaict and instead something unique about the customer.
Okay actually I wonder if this does have to do with you using Payment Request Button and other sites using Express Checkout Element which fixes a couple of the brittle edges of PRB. For instance, it looks like there is a known issue where if the customer doesn't have a name associated with the card via the "prefill in Chrome" method of accessing Google Pay (versus adding your card at pay.google.com) then Google Pay won't show in Payment Requset Button. This is discussed here https://chromestatus.com/feature/5532279906500608 / https://gist.github.com/rsolomakhin/d6d242cbb9306864ada5a29de7ab271e
Overall there were some rough edges with Payment Request Button that led to the creation of the Express Checkout Element for an improved experience. @sly birch are you open to migrating to Express Checkout Element? I would bet this would fix things here (we can also confirm that if your customer does indeed see Google Pay render on the above docs site I provided).
The user experiencing the issue on our site is seeing the GPay button loading via this link: #1433477161259372736 message
We can look into your last message in a bit, and yes we are open to upgrading to the Express Checkout Element, great to know that it should fix a lot of the prior issues
Is there a way for us to determine before we upgrade, for instance if we try to add the "name" to see if it would then load?
Sure have them go to chrome://settings/payments and see if they have a name set for their stored card there
sorry we have another meeting and will be back in a bit!
Also at the top of that page they should likely check that they have Fills in payment forms with your saved payment methods flipped on as well
we are doing the test you proposed
Sounds good
he has a card added on pay.google.com but not through this link you shared
not on chrome
Gotcha then the name issue likely isn't the problem though they could check that they have a name set there on pay.google.com too
and he can't toggle the top without any cards added
Can you have them visit this site: https://rsolomakhin.github.io/pr/gp2/ and what does it say at the top?
FYI i am taking over this thread - i'm still catching up but feel free to let me know once you've run the check bismarck just requested
hmmmmmmmmm
just double checking to make sure i undestand the thread correctly, they are seeing the button load on both of the following pages right?
https://4242.io/test/payment-request-button/
https://docs.stripe.com/testing/wallets?ui=payment-request-button-element
but they are never seeing it load on yours?
also FYI i need to restart my internet real quick but i will be back
this would point to an issue with how your application is handling things, but it looks like you're awaiting the response and everything, so i am kinda at a loss at the moment ๐
we were also wondering if this issue is specific to the version of stripe sdk we are using
good call, what version are you on?
we are adding some logic to make the call more than once, in case it IS a race condition
We are on these versions
"@stripe/react-stripe-js": "^2.1.0", "@stripe/stripe-js": "^1.52.1",
ooooo, those are indeed quite old
yea, we were told by someone earlier in this chat that that shouldn't be an issue
but maybe it is?
hmm yeah i also don't think so either
where exactly are you logging the canMakePaymentResult?
i wonder what happens if you log it every time your component re-renders, does it always return false?
ohhhh you're using next.js
i am less familiar with next.js to be honest
yeah but this useEffect runs client-side, so shouldn't make a difference. We had a ref that ensures the component only ran once, which we are now removing to see if it will succeed on future re-runs
kgeark_applepay-nextjs
๐ @unreal elm last time we spoke we recommend going through support instead of Discord for help since this had been repeated threads for days already without much progress here
I think this conversation is definitely helping us work through the problem, is it alright if we keep it open for now? Otherwise what is the best way to reach out to support
For this specific case: https://support.stripe.com/contact/email?topic=api_integration and there's a checkbox to say "I am a developer" so it gets straight to my team
I'm definitely happy to keep using Discord but we're a big team and you keep talking to different people each time without the history and it feels like something importnat is being missed that at least 6 people on my team haven't been able to help you with yet
got it, yes in that case we're happy to use the support. Will try to re-summarize the issue as best we can in the message
My advice: ignore your code for a bit. Start with the simplest demo that just does GooglePay and nothing else and let's debug that simple app first
If you are willing to do that, we'd likely make real progress on "is GooglePay working properly for you"
well, other users aren't experiencing this issue, only one user on our team is
we think it might be a potential race condition that only this user is intermittently experiencing
yeah but that seems so unlikely especially after days of trying to debug
But I guess if you build a simple demo quickly and they do see it there, then it means it's a code issue at least
yes we can try that
Sounds good. For now I'll close, I really think email would be best here.
also ask that person to load https://rsolomakhin.github.io/pr/gp2/ and share what they see on that page too
ah yeah sorry I missed that and only saw the wallet testing doc
all links you guys sent load successfully for them, which points to a code issue on our end
yeah that's fair but it seems really surprising at the scale of testing.
So try the simplest demo, confirm they see it and then slowly mirror your existing logic until you can reproduce I'd say
ok sounds good, we'll give that a shot and will also send support a message. Will that message start an email thread with your team?
yeah
thank you, good plan
But make sure you try the demo repro first
yep will do