stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

[Apple Pay] presentApplePay() and timeout

Open anija opened this issue 2 years ago • 2 comments

Hi,

I've succesfully implemented Apple Pay with this flux:

  1. presentApplePay to obtain paymentMethod
  2. server side call using the paymentMethod to obtain the clientSecret
  3. confirmApplePayPayment using the clientSecret

I've just one problem. If the server side call tooks too long, the applePay sheet close itself saying the app hasn't be able to complete the payment. I can't find any hint in documentation on how long is this timeout or (better) how to catch the sheet closing for timeout on frontend side (in order to cancel the request and don't proceed further and mark the payment as canceled for the user).

Any idea? Thank you.

anija avatar Oct 28 '21 10:10 anija

In addition to this:

If i try to do: const { error } = await confirmApplePayPayment(clientSecret); After the timeout message has been received and the applePay sheet has been closed, the promise is never resolved.

anija avatar Nov 09 '21 16:11 anija

Hello,

I also have a problem with the confirmApplePayPayment method which never resolve.

Here is what I do :

  • I execute presentApplePay method => Apple pay interface is properly displayed
  • The payment is processed in the backend (payment intent creation)
  • I click outside the apple pay payment interface before the process ends what closes the interface
  • The method confirmApplePayPayment then never resolves nor timeouts
const { error, paymentMethod } = await presentApplePay({...});
try {
    const stripeSecret = await processPaymentInBackend(...);
    const { error } = await confirmApplePayPayment(clientSecret);     // Never resolves if the apple pay interface is closed
catch(e) {...}

Expected behavior:

  • either : the confirmApplePayPayment throws a canceled error
  • or : the confirmApplePayPayment throws a timeout error

Any idea ? Thanks 🙏

ClementLevesque avatar Jan 31 '22 20:01 ClementLevesque