Checkout prices migration guide
Learn how to update your integration to use prices with Stripe Checkout.
The Prices API adds new features and flexibility to how you charge customers. This new integration offers:
- More unified modeling for Checkout items—instead of plans, SKUs, and inline line items, every item is now a price.
- The ability to render product images for recurring items.
- Create a reusable product and price catalog instead of one-time line items.
- Create inline pricing for subscriptions.
- Apply dynamic tax rates to subscriptions and one-time payments.
Don’t want to migrate? You can continue to use your current integration, but new features aren’t supported. You can use any new plans or recurring prices you create in the plan
parameter of your existing API calls.
Products and prices overview
Prices are a new, core entity within Stripe that works with subscriptions, invoices, and Checkout. Each price is tied to a single Product, and each product can have multiple prices. Different physical goods or levels of service should be represented by products. Pricing of that product should be represented by prices.
Prices define the base price, currency, and—for recurring products—the billing cycle. This allows you to change and add prices without needing to change the details of what you offer. For example, you might have a single “gold” product that has prices for 10 USD/month, 100 USD/year, 9 EUR/month, and 90 EUR/year. Or you might have a blue t-shirt with 20 USD and 15 EUR prices.
One-time payments
Integrations for one-time payments have the following changes:
- Instead of ad-hoc line items (that is, setting the name, amount, and currency), creating a Checkout Session requires creating a product and, usually, a price.
- mode is now required.
The client-side code remains the same.
Mapping table
Instead of defining each field on line_
, Checkout uses the underlying product and price objects to determine name, description, amount, currency, and images. You can create products and prices with the API or Dashboard.
Without prices | With prices |
---|---|
line_ | product. |
line_ | product. |
line_ |
|
line_ |
|
line_ | product. (displays the first image supplied) |
Server-side code for inline items
Previously, you could only create one-time items inline. With prices, you can continue to configure your items inline, but you can also define your prices dynamically with price_data when you create the Checkout Session.
When you create the Checkout Session with price_
, reference an existing product ID with price_data.product, or define your product details dynamically using price_data.product_data. The following example demonstrates the flow for creating a one-time item.
Server-side code for one-time prices
With this new integration, you can create a product and price catalog upfront instead of needing to define the amount, currency, and name each time you create a Checkout Session.
You can either create a product and price with the Prices API or through the Dashboard. You will need the price ID to create the Checkout Session. The following example demonstrates how to create a product and price through API:
Subscriptions
Integrations for recurring payments have the following changes:
- All items are passed into a single line_items field, instead of
subscription_
.data. items - mode is now required. Set
mode=subscription
if the session includes any recurring items.
The client-side code remains the same. Existing plans can be used wherever recurring prices are accepted.
Server-side code with plans
Here is a before and after example of creating a Checkout Session with a trial and using an existing plan, which can be used interchangeably with a price. The plan is now passed into line_
instead of subscription_
.
Server-side code for recurring price with setup fee
If you have recurring plans with a one-time setup fee, create the product and price representing the one-time fee before creating the Checkout Session. See the mapping table for how the old line_
fields map to the new integration. You can either create a product and price through the Prices API or through the Stripe Dashboard. You can also create the one-time item inline. The following example uses an existing price ID:
Response object changes
Instead of listing items with display_
, the Checkout Session object uses line_
. The line_
field does not render by default as display_
did, but you can include it using expand when creating a Checkout Session:
Webhook changes
Since line_
is includable, the checkout.
webhook response no longer list items by default. The smaller response object enables you to receive your Checkout webhooks faster. You can retrieve items with the new line_
endpoint:
For more details, see fulfilling orders with Checkout.