I have a product in Stripe with multiple prices, some recurring and a one-time price. (eg. $10/month, $100/year, $1,000 one-time)
For the recurring prices I use stripe.subscriptions.create
with the customer
, items
, etc. as described in the docs here. But I get an error if I try to list the one-time price in the items
array.
What is the correct way to handle a one-time price? Do I need to load the price, check if price.recurring
isn't set, and use a payment intent instead? This seems odd as it doesn't reference the product at all.
The Subscriptions API is designed for collecting recurring payments from customers, and that's why it would err if you specified a one-time price in the items
array.
Yes, you should check the type of the price before deciding whether to use Subscriptions API or PaymentIntents API.