About the Billing APIs
Understand how the Billing API objects work together.
We recommend using the Checkout Sessions API to create subscriptions. A Checkout Session gives your customer a payment page where they enter their payment details. Stripe then creates the customer, activates the subscription, and handles the payment process.
A subscription has:
- A Product to model what’s being sold.
- A Price to determine the interval and amount to charge.
- An object that represents a customer to store the Payment Methods used to make each recurring payment. Depending on how you represent your customers, this can be either a customer-configured Account or a Customer.
When you create a subscription, Stripe automatically generates an Invoice object at each billing cycle. Each Invoice automatically creates a PaymentIntent object to collect payment from the customer’s stored payment method. After you create the subscription, Stripe manages the rest of the billing lifecycle.
Use the Accounts v2 API to represent customers
The Accounts v2 API is generally available for Connect users, and in public preview for other Stripe users. If you’re part of the Accounts v2 preview, you need to specify a preview version in your code.
To join the Accounts v2 preview, go to Account previews and features in your Dashboard and enable Reusable payment methods for Global Payouts.
For most use cases, we recommend modeling your customers as customer-configured Account objects instead of using Customer objects.
API object definitions
| Resource | Definition |
|---|---|
| Account configured as a customer | Represents a customer in the Accounts v2 API who purchases a subscription. Configure an Account object as a customer and associate it with a subscription to make and track recurring charges and to manage the products that they subscribe to. For more information, see the Use Accounts as customers guide. |
| Customer | Represents a customer in the Customers API who purchases a subscription. Use the Customer object associated with a subscription to make and track recurring charges and to manage the products that they subscribe to. |
| Entitlement | Represents a customer’s access to a feature included in a service product that they subscribe to. When you create a subscription for a customer’s recurring purchase of a product, an active entitlement is automatically created for each feature associated with that product. When a customer accesses your services, use their active entitlements to enable the features included in their subscription. |
| Feature | Represents a function or ability that your customers can access when they subscribe to a service product. You can include features in a product by creating ProductFeatures. |
| Invoice | A statement of amounts a customer owes that tracks payment statuses from draft through paid or otherwise finalized. Subscriptions automatically generate invoices. |
| PaymentIntent | A way to build dynamic payment flows. A PaymentIntent tracks the lifecycle of a customer checkout flow and triggers additional authentication steps when required by regulatory mandates, custom Radar fraud rules, or redirect-based payment methods. Invoices automatically create PaymentIntents. |
| PaymentMethod | A customer’s payment methods that they use to pay for your products. For example, you can store a credit card on a customer-configured Account or Customer object and use it to make recurring payments for that customer. Typically used with the Payment Intents or Setup Intents APIs. |
| Price | Defines the unit price, currency, and billing cycle for a product. |
| Product | A good or service that your business sells. A service product can include one or more features. |
| ProductFeature | Represents a single feature’s inclusion in a single product. Each product is associated with a ProductFeature for each feature that it includes, and each feature is associated with a ProductFeature for each product that includes it. |
| Subscription | Represents a customer’s scheduled recurring purchase of a product. Use a subscription to collect payments and provide repeated delivery of or continuous access to a product. |
Here’s an example of how products, features, and entitlements work together. Imagine that you want to set up a recurring service that offers two tiers: a standard product with basic functionality, and an advanced product that adds extended functionality.
- You create two features:
basic_andfeatures extended_.features - You create two products:
standard_andproduct advanced_.product - For the standard product, you create one ProductFeature that associates
basic_withfeatures standard_.product - For the advanced product, you create two ProductFeatures: one that associates
basic_withfeatures advanced_and one that associatesproduct extended_withfeatures advanced_.product
A customer, first_, subscribes to the standard product. When you create the subscription, Stripe automatically creates an Entitlement that associates first_ with basic_.
Another customer, second_, subscribes to the advanced product. When you create the Subscription, Stripe automatically creates two Entitlements: one that associates second_ with basic_, and one that associates second_ with extended_.
You can determine which features to provision for a customer by retrieving their active entitlements or listening to the Active Entitlement Summary event. You don’t have to retrieve their subscriptions, products, and features.