#awells-applepay
1 messages ยท Page 1 of 1 (latest)
hello, what is your code doing between getting the paymentmethod callback from PaymentRequest Button
and before it hits
confirmCardPayment()
it's calling our backend to create an intent
which we can verify takes very little time
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)
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
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
could be Stripe, could be your code, we need to prove that
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
what determines whether the "done" tick shows in the apple pay modal?
your JS code calling ev.complete inside the paymentmethod callback from PaymentRequest Button
gotcha, so we're in direct control of that modal dismissing?
so line 16 here: https://stripe.com/docs/stripe-js/elements/payment-request-button#html-js-complete-payment
but line 12 will cause the "payment not succeeded dialog"
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
// Report to the browser that the confirmation was successful, prompting
// it to close the browser payment method collection interface.
ev.complete('success');
we'll debug and loop back, if you can keep this thread alive ๐
yes will keep it open