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

Show save card for future payment in Payment Sheet

Open saxenanihal95 opened this issue 5 years ago • 1 comments

Describe the bug In Payment Sheet documentation: https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet, in screenshot which shows checkbox save card for future payments, but when i open the payment sheet there is no checkbox for save card for future payments,

To Reproduce Steps to reproduce the behavior:

  1. Initialise payment sheet:
useEffect(() => {
    initialisePaymentSheet();
}, []);

const initialisePaymentSheet = async () => {
  setLoading(true);

  try {
    const {clientSecret, customerId} = await fetchPaymentSheetParams();

    const {error, paymentOption} = await initPaymentSheet({
      customerId,
      paymentIntentClientSecret: clientSecret,
      customFlow: true,
      merchantDisplayName: 'Example Inc.',
      applePay: true,
      merchantCountryCode: 'US',
      style: 'alwaysDark',
      googlePay: true,
      testEnv: true,
    });

    if (!error) {
      setPaymentSheetEnabled(true);
    }
    console.log({paymentOption});
    if (paymentOption) {
      setPaymentMethod(paymentOption);
    }
  } catch (error) {
    console.log('error', error);
  } finally {
    setLoading(false);
  }
};
  1. Choose Payment Option:
  const choosePaymentOption = async () => {
    const {error, paymentOption} = await presentPaymentSheet({
      confirmPayment: false,
    });

    if (error) {
      console.log('error', error);
    } else if (paymentOption) {
      setPaymentMethod({
        label: paymentOption.label,
        image: paymentOption.image,
      });
    } else {
      setPaymentMethod(null);
    }
  };

Expected behavior It should show save card for future payments

Screenshot 2021-07-12 at 11 20 06 AM

Screenshots Screenshot 2021-07-12 at 11 02 43 AM

Smartphone (please complete the following information):

  • Device: [e.g. iPhone12]
  • OS: [e.g. iOS14.1]
  • simulator

Additional context I am not sure if there is option to pass to show it

saxenanihal95 avatar Jul 12 '21 05:07 saxenanihal95

In order for the save card option to show up the customerEphemeralKeySecret secret needs to be provided: https://github.com/stripe/stripe-react-native/blob/master/example/src/screens/PaymentsUICompleteScreen.tsx#L55-L66

thorsten-stripe avatar Jul 12 '21 06:07 thorsten-stripe