#equilibrium_applepay-clickevent

1 messages ยท Page 1 of 1 (latest)

grave quartzBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1256276442262536355

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

rustic star
#

Do you have a URL where I can see this behavior?

clever reef
clever reef
#

I can add a bit more about this

we previously had a v1 project where we had the certificate and all was fine

we moved to a v2 project with the same domain (new code base) .. however, we forgot to move the certificate

while trying to fix Apple Pay today.. I added the certificate again and it's not working for some reason

I enabled/disabled Apple Pay + I enabled/disabled the domain and it's not working

Here's the certificate: https://global.celitech.com/.well-known/apple-developer-merchantid-domain-association

rustic star
#

I'm not able to get to the second step of the payment process. It just hangs indefinitely

clever reef
#

can you please refresh and re-try?

you need to pick destination/startDate/endDate/PackageSize and tick the checkbox

#

usually package size is picked automatically for you

rustic star
#

I had picked one before, just to be sure. Now I can't reload the page on Safari

clever reef
#

the page completely? what are you getting

rustic star
#

A timeout and a type error

clever reef
#

Its working fine on Chrome for me, can you please check that?

#

Also, its fine on Safari (mobile)

rustic star
#

Yeah, its still not working. In order to test Apple Pay I would need to be able to view the page in Safari unfortunately

clever reef
#

got it, are you using VPN by any chance? maybe that affected the response

rustic star
#

Yes, I am

clever reef
#

do you mind disabling it temporarily while checking the website? If you have an obligation to keep it, I understand

rustic star
#

For security reasons, I can't

clever reef
#

I understand, in that case, I removed some IP blocking that we had previously (due to some card testing attempts)

in case the VPN was getting blocked, it should probably work now

if its not, would it be possible to have this tested by your colleagues? where they can access the payment page (if its not possible for you)

rustic star
#

ALright, that worked

#

But Apple Pay is showing just fine

clever reef
#

its failing for some reason

#

"Something went wrong. Unable to show Apple Pay. Please choose a different payment method and try again."

#

My colleague tried it with his Apple Pay account

#

I have a test mode account URL if its possible for you to check it (to avoid charges)

clever reef
rustic star
#

Ahhhh, okay. Hold on just a sec

#

Ugh, the page hangs at random and now every time I try to enter details on the first page, it auto-submits the form when i select a date, which stops me from being able to select a package size. Then it hangs indifinitely

clever reef
#

the form will be temporarily disabled to recommend a package size for you, which should be really quick

rustic star
#

This feels kind of broken for Safari. It just hangs with a timeout again. Quitting out and starting again gets me this far. Incognito mode doesn't change anything.

clever reef
#

Is it possible to check it on mobile?

#

(using safari browser in the image above)

rustic star
#

I don't have an iPhone to test with unfortunately

#

What does the console say when you get to the payment page and submit?

clever reef
#

I forwarded the error as it when we confirm the payment intent as follow

  const result = await stripe.confirmPayment({
    elements,
    confirmParams: {
      return_url: `${window.location.origin}/install-your-esim?email=${email}`,
      payment_method_data: {
        billing_details: {
          email: email,
        },
      },
    },
  });

  if (result.error) {
    // Show error to your customer (for example, payment details incomplete)
    setMessage(result.error.message || "An unexpected error occurred.");
  }
rustic star
clever reef
#

I don't have Apple Pay account unfortunately (it's not supported in my country) my colleague was testing the charging end-to-end (he is US-based)

#

I think if I dont have Apple Pay => It wont show up as an option

#

Only card option shows up to me

rustic star
#

Ahhh, okay. Yea, unfortunately without someone to test and report back I'm kind of at a loss for how to assist here

clever reef
#

This is a test mode URL: https://qa-landing-page-celitech.vercel.app/ where you can test e2e (including payment)

But I think the VPN is causing some timeout issues from your end, do you think its possible to do anything about that? or maybe forward it to a colleague who can look into the issue?

rustic star
#

Let me do a quick restart in case the issue has something to do with recent updates on my box. Brb

#

Okay, we're getting somewhere now. I'm not seeing Safari pop up at all on the test site. Did you register that domain too?

clever reef
#

You mean Apple Pay?

#

let me double check

rustic star
#

Err, yeah sorry. Apple Pay isn't showing up at all

#

I'm noticing scripts are being blocked too, so you might have some CSP configuration that's blocking your site from getting JS scripts from Stripe

#

But yeah, also the domain isn't registered

clever reef
#

is it showing up now? on the test mode website

#

it was there already, but I disabled -> re-enabled it

grave quartzBOT
rustic star
#

Okay, it's showing up now, but I get this console error (second screenshot)

clever reef
#

the alert that you are getting is exactly what my colleague got in his e2e testing (2nd picture)

do you have any idea what can be the reason?

silent badger
#

Hi ๐Ÿ‘‹

I took a look at your testing side as well. It looks like there is a frame hosting issue to me

#

But I only see it when Apple Pay isn't available

#

I am able to see Apple Pay currently

clever reef
#

Hello @silent badger

silent badger
#

Currently I see Card and Apple Pay and 2 console errors about hcaptcha

clever reef
#

we added hcaptcha recently inside the Stripe element

could that have had an impact? (I see errors related to hcaptcha in the console.)

silent badger
#

It could potentially impact some functionality, since it interupts expected flows.

But, just so I can have a clear understanding, what is the current state of your quesiton? I am able to see the Apple Pay button within the Payment Element on your testing site. Is there something else that is not working?

#

Okay, I think I see the issue. When I attempt to launch the Apple Pay modal window I get the following in the console:

Error: The code that shows the Apple Pay payment sheet must be invoked directly by a user activation event, like a click or a touch gesture. To prevent this error make sure the code that shows the payment sheet is at or near the top of your user gesture event handler, before any async or long-running code.

clever reef
#

To clarify: we were able to see Apple Pay previously on our end, but the issue was that it failed to charge the end users as they are getting the same error above (that you got in your 2nd screenshot)

silent badger
#

It looks like you are putting the captcha in the Buy button click event, am I right?

clever reef
#

I just double checked and it looks like it

#

the button triggers the hcaptcha (which might or might not challenge the user)

on verification => hcaptcha generate token => new token triggers payment confirmation => payment confirmation is failing

#

I think this is the flow in summary

silent badger
#

Okay yeah that will cause Apple Pay to fail

#

They don't like anything sitting between the button click and launching apple pay

#

You would need to put your hcaptcha somewhere else in your flow

clever reef
#

the thing is, we had it in the 1st step only of our 3 steps flow

we were getting huge card testing attacks (people solving our captcha in the 1st step)
and then they can spam card testing in the 2nd flow (which doesn't have hcatpcha or bot detection tool)

so we solved that by having hcaptcha challenge in 1st step and 2nd step

#

so you please share any recommendation here ?

silent badger
#

You need to launch payment confirmation within 1 second or so of the user actually clicking the Buy button.

#

If you expect Apple Pay to work

clever reef
#

is this limit applicable to any other providers? or just Apple? Also please share the statement if its available anywhere in the docs (to share it with my dev team)

silent badger
#

perhaps you could add hcaptcha when the payment form loads?

This is an Apple Pay specific requirement. Although Google might have something similar but less strict. It's not a "Stripe thing", it's a digital wallet thing.

clever reef
#

got it

silent badger
#

As for docs, the error message itself has the detail you need

The code that shows the Apple Pay payment sheet must be invoked directly by a user activation event, like a click or a touch gesture.
clever reef
#

so I load/execute hcaptcha on page load instead of on button click

that would fix the issue while keeping the captcha on the 2nd page, right?

silent badger
#

So anything that puts a delay between the user action and the display of the payment sheet breaks that contract

#

Yes

#

Apple Pay's issue here is the link between the button click and when the payment sheet is displayed to the user

#

So you could put hcatpcha in other palces as long as the button click was simplified to just confirming the payment.

clever reef
#

got it, i actually spent like 10 hours maybe just debugging this, it was super confusing (and I thought its certificates related)

silent badger
#

Yeah I can understand that pain ๐Ÿ˜…

clever reef
#

๐Ÿ˜…

silent badger
#

Certificates and domains can make Apple Pay pretty tricky

clever reef
#

I think the certificate is only to show/hide the Apple Pay button, right? (aka if its showing then its not certificate related) right?

silent badger
#

The cert is how Apple's JavaScript will determine if you are a valid merchant to display Apple Pay at all

#

So if your cert is wrong (or your domain) you just won't see it as an option

clever reef
#

so if its showing, all is good for the certificate and this is another type of issue

#

(our case)

silent badger
#

Yup

clever reef
#

AWESOME THEN, I APPRECIATE ALL YOUR HELP @silent badger @rustic star

#

Thank you guys alot, I'll be looking into hcaptcha and see how it goes

#

Many thanks โค๏ธ

silent badger
#

We're happy to shed what ๐Ÿ’ก we can ๐Ÿ™‚

it's why we're here

clever reef
#

I appreciate it :D