stripe / stripe-react-native

React Native library for Stripe.
https://stripe.dev/stripe-react-native
MIT License
1.27k stars 263 forks source link

presentPaymentSheet UI Doesn't Appear, Screen Dims, iOS only #1619

Open WelshDev opened 7 months ago

WelshDev commented 7 months ago

Describe the bug On iOS when calling presentPaymentSheet, this does not display the UI. The screen slightly dims and stays like this forever. Tapping on the top half cancels the payment. Tapping where the UI should be visible, this causes the keyboard to appear and/or a country select dropdown. It's as if the fields are there but they're just invisible. This exact same code works just fine on Android. This is being developed on an iPhone Xr but has also been submitted and deployed via TestFlight for testing on other devices and they're all seeing the same. According to Stripe the payment intent and all of that is being created just fine.

Expected behavior On android devices the payment UI appears as expected and I can complete a payment without issue. This is only an issue on iOS devices. I would expect the UI to appear which allows you to enter your card details. In the attached video, when the screen goes light again, that's me tapping the top 50% or so of the screen which causes the payment to cancel.

Screenshots https://github.com/stripe/stripe-react-native/assets/57954883/8ebdd62a-9607-4a54-a4e6-d495987f173c

Device & Versios:

My Code


        // Grab params we need from server
        const {
            error,
            paymentIntent,
            ephemeralKey,
            customer,
        } = await fetchPaymentParams();

        // Got an error?
        if(error)
        {
            // Grab the error
            setCheckoutError(error.message);
        }
        else
        {
            // Initiate payment sheet
            const { error } = await initPaymentSheet({
                customerId: customer,
                customerEphemeralKeySecret: ephemeralKey,
                paymentIntentClientSecret: paymentIntent,
                merchantDisplayName: 'Example Ltd'
            });

            // Got an error?
            if(error)
            {
                // Grab the error
                setCheckoutError(error.message);
            }
            else
            {
                // Display the payment UI
                const { error } = await presentPaymentSheet();

                // Got an error?
                if(error)
                {
                    // Grab the error
                    setCheckoutError(error.message);
                }
                else
                {
                    // Navigate to success
                    navigation.navigate('PurchaseSuccess');
                }
            }
        }
    };```
WelshDev commented 7 months ago

This seems to be the same as https://github.com/stripe/stripe-react-native/issues/1581

loveheenavasu commented 7 months ago

Hi @WelshDev , I was facing the same issue.

below updates worked for me

I hope it will solve your problem too , and if you find any other solution kindly do mention that.

Happy Coding

mahendraios commented 7 months ago

I have tried all the above mentioned steps, but still I'm not seeing PaymentSheet. @loveheenavasu

charliecruzan-stripe commented 7 months ago

This is due to the older version of stripe-react-native. If you're seeing this on v0.37.0, can you please link a project that reproduces this behavior?