#kacper - RN PaymentSheet close
1 messages · Page 1 of 1 (latest)
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>
);
}```
The problem is that PaymentSheet close before promise presentPaymentSheet() is resolved,
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?
Exactly, after PaymentSheet close i have to wait like 2 seconds to resolve promise
Gotcha, looking in to if there is something faster
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