#awells-applepay

1 messages ยท Page 1 of 1 (latest)

cosmic patio
#

hello, what is your code doing between getting the paymentmethod callback from PaymentRequest Button

and before it hits
confirmCardPayment()

hardy plaza
#

it's calling our backend to create an intent

#

which we can verify takes very little time

cosmic patio
#

ok lets add explicit timestamps in your JS code

1/ when paymentmethod is triggered first
2/ you about to make a backend request
3/ your backend request completes
4/ confirmCardPayment() being called
5/ confirmCardPayment() resolves with a result

pls log those timestamps out with the string of what that respective log is doing like

console.log("about to call backend")
console.log(timestampNow)
hardy plaza
#

is there a way to do this without making this change?

#

we can confirm that the backend request takes <2s

#

and then the confirmCardPayment is called immediately after

cosmic patio
#

sure but without explicit timestamps, we won't know what part of the code is taking long, there are other timestamps needed too, like whether ev.complete is ever hit or not

so really, right now we're in the dark, we need explicit timestamps that you and I can both agree on and then we can narrow down what part is problematic

right now we're still at the stage of "something is wrong, don't know what"

#

to clarify

we're seeing the apple modal say "payment not completed" and take a long time to process
happens when the Apple Pay sheet times out after ~20-30 seconds, so something is taking that long, we need to narrow down what

hardy plaza
#

gotcha ๐Ÿ™‚

#

we'll make the changes

cosmic patio
#

could be Stripe, could be your code, we need to prove that

hardy plaza
#

could it be apple?

#

cos this works fine with google pay

cosmic patio
#

most likely no cause Stripe.js already called your paymentmethod callback so Apple Pay did its part in getting card details to Stripe and Stripe created a PaymentMethod for you and gave it to your JS code

hardy plaza
#

what determines whether the "done" tick shows in the apple pay modal?

cosmic patio
#

your JS code calling ev.complete inside the paymentmethod callback from PaymentRequest Button

hardy plaza
#

gotcha, so we're in direct control of that modal dismissing?

cosmic patio
#

gotcha, so we're in direct control of that modal dismissing?
yep, and there are 2 cases where you'll see the error you're seeing

1/ ev.complete('fail') is called
2/ you don't call `ev.compelte('success') in 20 seconds so it times out

hardy plaza
#

I see!

#

thanks ๐Ÿ™‚

cosmic patio
#
 // Report to the browser that the confirmation was successful, prompting
  // it to close the browser payment method collection interface.
 ev.complete('success');
hardy plaza
#

we'll debug and loop back, if you can keep this thread alive ๐Ÿ™

cosmic patio
#

yes will keep it open