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

Payment sheet opens multiple times if it was closed before by the user

Open hbel opened this issue 1 year ago • 0 comments
trafficstars

Describe the bug

The Paymentsheet offers a close button that closes the presented sheet with an error: The payment option selection flow has been cancelled.

When I try to open the sheet again, it opens up twice. I can close the second sheet, but the first sheet is not respondng at all and is blocking the UI.

This is independent whether I call initPaymentSheet again before opening up the sheet for the second time or not.

Please note that other Error (like Country code is invalid) don't lead to this error. Also the happy path is working as expected.

To Reproduce Steps to reproduce the behavior: This is the basic flow I am performing inside my payment screen:

initPaymentSheet({
				...sheetData,
				customFlow: true,
				merchantDisplayName: "Example Inc.",
				returnURL: "famfam://return-url",

				defaultBillingDetails: {
					name: inviteState.fullName,
					address: {
						city: inviteState.city,
						country: inviteState.countryCode,
						line1: inviteState.address,
						postalCode: inviteState.zipCode,
					},
				},
				billingDetailsCollectionConfiguration: {
					name: PaymentSheet.CollectionMode.NEVER,
					email: PaymentSheet.CollectionMode.NEVER,
					address: PaymentSheet.AddressCollectionMode.NEVER,
					attachDefaultsToPaymentMethod: true,
				},
			})
				.then(({ error }) => {
					if (error) {
						throw error;
					}
				})
				.then(() => presentPaymentSheet())
				.then(({ error }) => {
					if (error) {
						throw error;
					}
				})
				.then(confirmPaymentSheetPayment)
				.then(({ error }) => {
					if (error) {
						throw error;
					}
				})
				.then(next)
				.catch(e => {
					setError(e.message ?? "Unknown error");
					reset();
				});
		}

Expected behavior After presentPaymentSheet ran into an error, the whole payment sheet internals should be resetted to a blank slate.

Smartphone (please complete the following information):

  • Device: any IPhone
  • OS: iOS 17.4
  • Version: 0.35.1 with Expo SDK 50

Additional context Add any other context about the problem here.

hbel avatar Apr 03 '24 16:04 hbel