Reputation: 301
I am creating subscription using meter based pricing in stripe
const stripeRequest: Stripe.SubscriptionCreateParams = {
customer: customerId,
items: [
{
price: xxxxxx
},
],
payment_settings: {
payment_method_types: ["card"],
save_default_payment_method: "on_subscription",
},
expand: ["latest_invoice.payment_intent"],
};
const stripeSubscription = await stripe.subscriptions.create(
stripeRequest,
);
stripeSubscription.latest_invoice.payment_intent is coming as null
Upvotes: 0
Views: 259
Reputation: 2219
For metered subscriptions, the customer is billed at the end of the billing period. So when you create a new metered subscription, an invoice is immediately created with a $0 amount. And since there's nothing to pay, it's expected that the invoice will have no PaymentIntent.
However the subscription object will contain a pending_setup_intent
property. You could use the client_secret
of this SetupIntent to collect a payment method on the frontend.
Upvotes: 2