'Save payment for later option, Stripe, React Native, Expo

I'm trying to setup a way to setup a payment for later with a prebuilt Stripe component in a React Native Expo Project.

I'm following along with this project: https://snack.expo.dev/@charliecruzan/stripe-react-native-example?platform=mydevice

If you go to PaymentsUICustomScreen.tsx, you can see that there is an option to save payments for later when the option is rendered on the screen. enter image description here

When I implement the same code, I do not get that same option.

I'm using the useStripe function.

This is the flow:

import { useStripe } from '@stripe/stripe-react-native'
...
    const { initPaymentSheet, presentPaymentSheet } = useStripe();
...
await initPaymentSheet({
    customerId: 'customerID',
    // customerEphemeralKeySecret: ephemeralKey,
    paymentIntentClientSecret: clientSecret,
    customFlow: false,
    merchantDisplayName: 'Example Inc.',
    applePay: true,
    merchantCountryCode: 'US',
    style: 'alwaysDark',
    googlePay: true,
    testEnv: true,
});

My question is, why do I not get the save payment methods for later option?



Solution 1:[1]

You should use the ephemeralKeys in your Frontend and as well as in your backend so that after successful payment of the user, the payment details such as card details will be saved securely in stripe.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1