#kacper - RN PaymentSheet close

1 messages · Page 1 of 1 (latest)

manic forge
#

Good question. Checking in to this

#

Does the second code snipped in this section help you? I think you can trigger this when the promise resolves https://stripe.com/docs/payments/accept-a-payment?platform=react-native#react-native-collect-payment-details

  // continued from above

  const openPaymentSheet = async () => {
    const { error } = await presentPaymentSheet();

    if (error) {
      Alert.alert(`Error code: ${error.code}`, error.message);
    } else {
      Alert.alert('Success', 'Your order is confirmed!');
    }
  };

  return (
    <Screen>
      <Button
        variant="primary"
        disabled={!loading}
        title="Checkout"
        onPress={openPaymentSheet}
      />
    </Screen>
  );
}```
dense halo
#

The problem is that PaymentSheet close before promise presentPaymentSheet() is resolved,

manic forge
#

When are you looking to add the loader? The original question said after the PaymentSheet closes, is this promise taking too long after the close?

dense halo
#

Exactly, after PaymentSheet close i have to wait like 2 seconds to resolve promise

manic forge
#

Gotcha, looking in to if there is something faster

manic forge
#

Unfortunately I am not seeing a good way to react to the PaymentSheet closing sooner, you may want to just start rendering the loader behind the payment sheet once you launch it