Search code examples
react-nativestripe-paymentssubscription

React-native Stripe Payment Sheet with Subscription


I'm using stripe-react-native to handle payment, and I'm able to handle one-time payment via payment-sheet using PaymentIntent flow.

Now I'm stuck with creating subscription using the same payment sheet flow, has anyone tried this before? Or an advise how to use PaymentIntent in subscription?


Solution

  • You need to expand the subscription object with payment intent.

    const subscription = await stripe.subscriptions.create({
      ...subscriptionSettings
      expand: ['latest_invoice.payment_intent']
    });
    

    You can then access it using:

    const paymentIntent = subscription.latest_invoice.payment_intent
    const clientSecret = subscription.latest_invoice.payment_intent.client_secret