#kgeark_applepay-nextjs

1 messages ยท Page 1 of 1 (latest)

thorny yokeBOT
#

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

tardy osprey
#

Adding @sly birch who is the lead developer on this issue and @unreal elm who is the FE manager to help add more context

coral vault
#

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.

tardy osprey
#

No stripe pay is the only processor this site uses - so we are using the stripe SDK

coral vault
#

Do you have a publicly accessible test page?

tardy osprey
#

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

coral vault
#

Pay.js, that's the GPay script, right?

tardy osprey
#

correct

coral vault
#

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?

tardy osprey
#

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

coral vault
tardy osprey
#

Thanks for sharing this Im taking a look now - the report from our customers and the testing we have done its intermittent

thorny yokeBOT
tardy osprey
#

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?

fickle folio
#

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

tardy osprey
#

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

fickle folio
#

Sounds good no rush

sly birch
#

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 }

fickle folio
#

Wait you are seeing googlePay: false but expecting the button to render?

sly birch
#

We are getting googlePay: false when we should be getting googlePay: true

fickle folio
#

You are the one testing this?

#

How do you know it is a legitimate card?

sly birch
#

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

unreal elm
#

Hi there, yes the user with the issue on our site can load the google pay button on other sites

fickle folio
#

Overall this seems like something unique to this customer's card...

sly birch
#

Yes the other sites are on Stripe

#

We will verify what happens if they visit the above link and get back to you

fickle folio
#

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).

unreal elm
#

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?

fickle folio
#

Sure have them go to chrome://settings/payments and see if they have a name set for their stored card there

unreal elm
#

sorry we have another meeting and will be back in a bit!

fickle folio
#

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

unreal elm
#

we are doing the test you proposed

fickle folio
#

Sounds good

unreal elm
#

he has a card added on pay.google.com but not through this link you shared

#

not on chrome

fickle folio
#

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

unreal elm
#

and he can't toggle the top without any cards added

fickle folio
thorny yokeBOT
terse nymph
#

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

sly birch
#

This is what is seen when they visit the link

terse nymph
#

hmmmmmmmmm

terse nymph
#

also FYI i need to restart my internet real quick but i will be back

unreal elm
#

yes that's correct

#

they can see it also on our competitor sites

terse nymph
unreal elm
#

we were also wondering if this issue is specific to the version of stripe sdk we are using

terse nymph
#

good call, what version are you on?

unreal elm
#

we are adding some logic to make the call more than once, in case it IS a race condition

sly birch
#

We are on these versions
"@stripe/react-stripe-js": "^2.1.0", "@stripe/stripe-js": "^1.52.1",

terse nymph
#

ooooo, those are indeed quite old

unreal elm
#

yea, we were told by someone earlier in this chat that that shouldn't be an issue

#

but maybe it is?

terse nymph
#

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

thorny yokeBOT
unreal elm
#

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

woven cosmos
#

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

unreal elm
#

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

woven cosmos
#

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

unreal elm
#

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

woven cosmos
#

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"

unreal elm
#

well, other users aren't experiencing this issue, only one user on our team is

woven cosmos
#

Ahhhhhhh

#

so this is unlikely to have anything to do with your code I think

unreal elm
#

we think it might be a potential race condition that only this user is intermittently experiencing

woven cosmos
#

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

unreal elm
#

yes we can try that

thorny yokeBOT
woven cosmos
unreal elm
#

yep they loaded that successfully

#

the screenshot is above

#

in the chat

woven cosmos
#

ah yeah sorry I missed that and only saw the wallet testing doc

unreal elm
#

all links you guys sent load successfully for them, which points to a code issue on our end

woven cosmos
#

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

unreal elm
#

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?

woven cosmos
#

yeah

unreal elm
#

thank you, good plan

woven cosmos
#

But make sure you try the demo repro first

unreal elm
#

yep will do