'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 1:[1]

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

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 Ethan Crabb