Manage products and prices
You can create and update products and prices in the Dashboard or through the API.
Some advanced use cases, like creating variable prices, require you to use the API. If you have a large number of products and prices or if you’re building a custom integration with Elements, you need to use the API.
- Use the Dashboard to create and manage products and prices if you want to avoid writing code or if you only have a few products and prices. Set up your pricing model in test mode and click the Copy to live mode button on the product details page.
- Use the API or the Stripe CLI to create and manage products and prices. The API is a direct method that you use for production implementations. The Stripe CLI is a developer tool that helps you build, test, and manage your integration with Stripe directly from your terminal.
The following API steps use a fictional SaaS collaboration tool (Togethere) as an example, where the basic product is a project management dashboard.
Archive a product
If you want to disable a product so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a product, any existing subscriptions that use the product remain active until they’re canceled and any existing payment links that use the product are deactivated. You can’t delete products that have an associated price, but you can archive them.
Delete a product
You can only delete products that have no prices associated with them. Alternatively, you can archive a product.
You can create single or multiple prices for a product. For example, Togethere may have a “starter” level offered at 10 USD per month, 100 USD per year, or 9 EUR as a one-time purchase.
After you create a price, you can only update its
Set a default price
A product’s default price is the most common price you want to present to customers. For example, a product could have multiple prices for seasonal sales, but the default is the regular (non-sale) price. If your product only has one price, that is its default price. The default price must be an active Price.
Most businesses display pricing information on their website. If these prices are hard-coded and you want to change them, the process is often manual and requires you to deploy new code. To better manage these scenarios, you can use the lookup_key attribute on the Price object. This key allows you to:
- Render different prices in your frontend.
- Use the rendered price to bill customers.
You can pass a
lookup_key when you create a price:
Instead of hard-coding text like 10 USD per month on your pricing page and using a price ID on your backend, you can query for the price using the
standard_monthly key and then render that in your frontend:
To optimize performance, you might want to add a caching layer to only reload the price occasionally.
When a customer clicks your subscribe or pay button, you pass the price from the
GET request above into the Subscriptions API.
Now that you can render different prices, if you decide that you want to start charging new users 20 USD per month rather than 10 USD per month, you only need to create a new price and transfer the lookup key to that new price using transfer_lookup_key=true:
Rounding occurs on the line item level of your invoices. For example, if you create a price with
unit_amount_decimal = 0.05 and a monthly subscription for that [price] with
quantity = 30, rounding occurs after multiplying the quantity by the decimal amount. In this case, the calculated amount for the line item would be
0.05 * 30 = 1.5, which rounds up to 2 cents. If you have multiple line items, each is rounded up before summing up the total amount for the invoice. This ensures that customers are still charged an integer minor unit amount, as decimal amounts only apply for pricing.
Edit a price
Multiple properties can be updated on a price, either in the Dashboard or the API. For example, you can change whether the price is active, or modify its metadata.
Note that you can not change a price’s amount in the API. Instead, we recommend creating a new price for the new amount, switch to the new price’s ID, then update the old price to be inactive.
Archive a price
If you want to disable a price so that it can’t be added to new invoices or subscriptions, you can archive it. If you archive a price, any existing subscriptions that use the price remain active until they’re canceled and any existing payment links that use the product are deactivated.
Delete a price
You can only delete prices that you’ve never used. Otherwise, you can archive them.
Display pricing information
After creating products and prices, you can embed a pricing table on your website to display pricing information to your customers. When customers choose a subscription option, they’re taken directly to checkout. Configure, customize, and update directly in the Dashboard without writing any code.