# Recurring pricing models Learn about the pricing models you can use with subscriptions. Pricing models are patterns that represent your business on Stripe and consists of the products or services you sell, how much they cost, what currency you accept for payments, and the service interval for subscriptions. To build the pricing model, you use [products](https://docs.stripe.com/api/products.md)—what you sell—and [prices](https://docs.stripe.com/api/prices.md)—how much and how often to charge for your products. | Pricing model | Description | | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [Flat rate](#flat-rate) | Customers choose a service tier (for example, Basic, Starter, or Enterprise) and pay a flat rate for it. | | [Per-seat](#per-seat) | Each pricing unit represents one user. For example, a business purchases software for its employees and each employee requires a license to access the software. | | [Tiered](#tiered-pricing) | The unit cost changes with quantity (volume-based pricing) or usage (graduated pricing). | | [Usage-based](#usage-based-pricing) | Charge customers based on their usage of your product or service. It includes fixed fee and overage, pay as you go, and credit burndown pricing models. | ## Flat-rate pricing Many SaaS businesses offer their customers a choice of escalating service options. Customers choose a service tier and pay a flat rate for it. Imagine a business called Togethere that sells a collaboration platform. They offer three different service levels: basic, starter, and enterprise. For each service level, they offer a monthly and yearly price. ![](images/billing/product-catalog/pricing_model-flat-rate.png) Flat-rate pricing model In this example, Togethere has three products: `Basic`, `Starter`, and `Enterprise`. Each product has several different prices. The basic level has prices for 10 USD per month and 100 USD per year. Both prices are for the same `Basic` product, so they share the same product description on the customer’s receipt and invoice. Type “product.new” into the address bar of any browser to open the [Product Editor](https://dashboard.stripe.com/products/create). First, create the `Basic` product. To learn about all the options for creating a product, see the [prices guide](https://docs.stripe.com/products-prices/manage-prices.md#create-product). 1. Go to [Product catalog](https://dashboard.stripe.com/products). 1. Click **+ Create product**. 1. Enter a **Name** for the product. 1. (Optional) Add a **Description**. The description appears at checkout, on the [customer portal](https://docs.stripe.com/customer-management.md), and in [quotes](https://docs.stripe.com/quotes.md). Next, create the monthly price for the `Basic` product: 1. Click **More pricing options**. 1. Select **Recurring**. 1. For **Choose your pricing model**, select **Flat rate**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Monthly**. 1. Click **Next** to save the price. 1. For **Pricing model**, select **Standard pricing**. 1. Select **Recurring**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Monthly**. Then, create the yearly price for the `Basic` product: 1. Click **+ Add another price**. 1. Select **Recurring**. 1. For **Choose your pricing model**, select **Flat rate**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Yearly**. 1. Click **Next**. 1. Click **Add product** to save the product and price. You can only edit the product and price until you create a subscription with them. 1. Click **+ Add another price**. 1. For the **Pricing model**, select **Standard pricing**. 1. Select **Recurring**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Yearly**. 1. Click **Add product** to create the product and prices. You can only edit the product and price until you create a subscription with them. 1. Create a Product for the `Basic` service level. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductCreateOptions { Name = "Basic" }; var service = new ProductService(); Product product = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductParams{Name: stripe.String("Basic")}; result, err := product.New(params); ``` ```java Stripe.apiKey = "<>"; ProductCreateParams params = ProductCreateParams.builder().setName("Basic").build(); Product product = Product.create(params); ``` ```node const stripe = require('stripe')('<>'); const product = await stripe.products.create({ name: 'Basic', }); ``` ```python import stripe stripe.api_key = "<>" product = stripe.Product.create(name="Basic") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $product = $stripe->products->create(['name' => 'Basic']); ``` ```ruby Stripe.api_key = '<>' product = Stripe::Product.create({name: 'Basic'}) ``` 1. Create the monthly price for the `Basic` product. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Product = "<>", UnitAmount = 1000, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "month" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Product: stripe.String("<>"), UnitAmount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), }, }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setProduct("<>") .setUnitAmount(1000L) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .build() ) .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ product: '<>', unit_amount: 1000, currency: 'usd', recurring: { interval: 'month', }, }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( product="<>", unit_amount=1000, currency="usd", recurring={"interval": "month"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'product' => '<>', 'unit_amount' => 1000, 'currency' => 'usd', 'recurring' => ['interval' => 'month'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ product: '<>', unit_amount: 1000, currency: 'usd', recurring: {interval: 'month'}, }) ``` 1. Create the yearly price for the `Basic` product. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Product = "<>", UnitAmount = 10000, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "year" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Product: stripe.String("<>"), UnitAmount: stripe.Int64(10000), Currency: stripe.String(string(stripe.CurrencyUSD)), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalYear)), }, }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setProduct("<>") .setUnitAmount(10000L) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.YEAR) .build() ) .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ product: '<>', unit_amount: 10000, currency: 'usd', recurring: { interval: 'year', }, }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( product="<>", unit_amount=10000, currency="usd", recurring={"interval": "year"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'product' => '<>', 'unit_amount' => 10000, 'currency' => 'usd', 'recurring' => ['interval' => 'year'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ product: '<>', unit_amount: 10000, currency: 'usd', recurring: {interval: 'year'}, }) ``` Repeat these steps to create the `Starter` and `Enterprise` products and their associated prices. After you create this pricing model, you’re ready to use them to create [subscriptions](https://docs.stripe.com/api/subscriptions.md) for your customers. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new SubscriptionCreateOptions { Customer = "<>", Items = new List { new SubscriptionItemOptions { Price = "{{RECURRING_PRICE_ID}}" }, }, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.SubscriptionParams{ Customer: stripe.String("<>"), Items: []*stripe.SubscriptionItemsParams{ &stripe.SubscriptionItemsParams{Price: stripe.String("{{RECURRING_PRICE_ID}}")}, }, }; result, err := subscription.New(params); ``` ```java Stripe.apiKey = "<>"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("<>") .addItem(SubscriptionCreateParams.Item.builder().setPrice("{{RECURRING_PRICE_ID}}").build()) .build(); Subscription subscription = Subscription.create(params); ``` ```node const stripe = require('stripe')('<>'); const subscription = await stripe.subscriptions.create({ customer: '<>', items: [ { price: '{{RECURRING_PRICE_ID}}', }, ], }); ``` ```python import stripe stripe.api_key = "<>" subscription = stripe.Subscription.create( customer="<>", items=[{"price": "{{RECURRING_PRICE_ID}}"}], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $subscription = $stripe->subscriptions->create([ 'customer' => '<>', 'items' => [['price' => '{{RECURRING_PRICE_ID}}']], ]); ``` ```ruby Stripe.api_key = '<>' subscription = Stripe::Subscription.create({ customer: '<>', items: [{price: '{{RECURRING_PRICE_ID}}'}], }) ``` ## Per-seat pricing Per-seat pricing is a linear pricing model where the number of seats (for example, software licenses) maps to the number of units (for example, users). Togethere, our example collaboration platform company, also wants to offer a per-seat plan. Togethere’s customers pick how many seats they’ll use, and Togethere charges based on that amount. ![](images/billing/product-catalog/pricing_model-per-seat.png) Per-seat pricing model To create a model for this scenario, Togethere creates a product and price structure where each unit represents a user. When Togethere creates a subscription for a customer, the customer specifies the number of users for that subscription. First, create the `Per-seat` product. To learn about all the options for creating a product, see the [prices guide](https://docs.stripe.com/products-prices/manage-prices.md#create-product). 1. Go to [Product catalog](https://dashboard.stripe.com/products). 1. Click **+ Create product**. 1. Enter a **Name** for the product. 1. (Optional) Add a **Description**. The description appears at checkout, on the [customer portal](https://docs.stripe.com/customer-management.md), and in [quotes](https://docs.stripe.com/quotes.md). Next, create the monthly price for the product: 1. Select **Recurring**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Monthly**. 1. Click **Add product** to save the product and price. You can only edit the product and price until you create a subscription with them. 1. Select **Standard pricing** for the **Pricing model**, then select **Recurring**. 1. For **Amount**, enter a price amount. 1. For **Billing period**, select **Monthly**. 1. Click **Add product** to save the product and price. You can only edit the product and price until you create a subscription with them. To create a subscription using that price: 1. Go to the **Payments** > **Subscriptions** page. 1. Click **+ Create subscription**. 1. Find or add a customer. 1. Search for the product you created and select the price you want to use. 1. (Optional) Select **Collect tax automatically** to use Stripe Tax. 1. Click **Start subscription** to start it immmediately or **Schedule subscription** to start it on another schedule. 1. Create the `Per-seat` product. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductCreateOptions { Name = "Per-seat" }; var service = new ProductService(); Product product = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductParams{Name: stripe.String("Per-seat")}; result, err := product.New(params); ``` ```java Stripe.apiKey = "<>"; ProductCreateParams params = ProductCreateParams.builder().setName("Per-seat").build(); Product product = Product.create(params); ``` ```node const stripe = require('stripe')('<>'); const product = await stripe.products.create({ name: 'Per-seat', }); ``` ```python import stripe stripe.api_key = "<>" product = stripe.Product.create(name="Per-seat") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $product = $stripe->products->create(['name' => 'Per-seat']); ``` ```ruby Stripe.api_key = '<>' product = Stripe::Product.create({name: 'Per-seat'}) ``` 1. Create a price for the monthly fee. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Product = "<>", UnitAmount = 1000, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "month" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Product: stripe.String("<>"), UnitAmount: stripe.Int64(1000), Currency: stripe.String(string(stripe.CurrencyUSD)), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), }, }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setProduct("<>") .setUnitAmount(1000L) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .build() ) .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ product: '<>', unit_amount: 1000, currency: 'usd', recurring: { interval: 'month', }, }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( product="<>", unit_amount=1000, currency="usd", recurring={"interval": "month"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'product' => '<>', 'unit_amount' => 1000, 'currency' => 'usd', 'recurring' => ['interval' => 'month'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ product: '<>', unit_amount: 1000, currency: 'usd', recurring: {interval: 'month'}, }) ``` 1. When you create the [subscription](https://docs.stripe.com/api/subscriptions.md), specify a `quantity` to charge for the number of seats. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new SubscriptionCreateOptions { Customer = "<>", Items = new List { new SubscriptionItemOptions { Price = "{{per_seat_price_id}}", Quantity = 12 }, }, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.SubscriptionParams{ Customer: stripe.String("<>"), Items: []*stripe.SubscriptionItemsParams{ &stripe.SubscriptionItemsParams{ Price: stripe.String("{{per_seat_price_id}}"), Quantity: stripe.Int64(12), }, }, }; result, err := subscription.New(params); ``` ```java Stripe.apiKey = "<>"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("<>") .addItem( SubscriptionCreateParams.Item.builder() .setPrice("{{per_seat_price_id}}") .setQuantity(12L) .build() ) .build(); Subscription subscription = Subscription.create(params); ``` ```node const stripe = require('stripe')('<>'); const subscription = await stripe.subscriptions.create({ customer: '<>', items: [ { price: '{{per_seat_price_id}}', quantity: 12, }, ], }); ``` ```python import stripe stripe.api_key = "<>" subscription = stripe.Subscription.create( customer="<>", items=[{"price": "{{per_seat_price_id}}", "quantity": 12}], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $subscription = $stripe->subscriptions->create([ 'customer' => '<>', 'items' => [ [ 'price' => '{{per_seat_price_id}}', 'quantity' => 12, ], ], ]); ``` ```ruby Stripe.api_key = '<>' subscription = Stripe::Subscription.create({ customer: '<>', items: [ { price: '{{per_seat_price_id}}', quantity: 12, }, ], }) ``` ## Tiered pricing Prices can represent tiers, allowing the unit cost to change with quantity or usage. Use tiers if you need non-linear pricing when `quantity` or [usage](https://docs.stripe.com/api/billing/meter-event.md) changes. You can also combine tiered pricing with base fees to create [usage-based pricing models](#usage-based-pricing). For example, Togethere wants to offer lower rates for customers who use more projects per month. The following tiered pricing models show two different ways to adjust pricing as usage increases: volume-based pricing and graduated pricing. To demonstrate these approaches to tiered pricing, we’ll use the following tiers: | | Number of projects | Price per tier | | ----------- | ------------------ | -------------- | | First tier | 1-5 | 7 USD | | Second tier | 6-10 | 6.50 USD | | Third tier | 11+ | 6 USD | ### Volume-based pricing With volume-based pricing, the subscription item bills at the tier corresponding to the amount of usage at the end of the period. The entire `quantity` (or `usage`) is multiplied by the unit cost of the tier. Because the tier price applies to the entire `quantity` (or `usage`), the total might decrease when calculating the final cost. For example, a customer with 5 projects is charged 35 USD (5 × 7 USD). If they accumulate 6 projects the following month, then all projects bill at the `6-10` rate. That month, they’re charged 39 USD (6 × 6.50 USD). | Quantity and usage at end of the period | Unit cost | Total monthly cost | | --------------------------------------- | --------- | ------------------ | | 1 | 7 USD | 7 USD | | 5 | 7 USD | 35 USD | | 6 | 6.50 USD | 39 USD | | 20 | 6 USD | 120 USD | | 25 | 6 USD | 150 USD | 1. Go to the [Product catalog](https://dashboard.stripe.com/products). 1. Click **+ Create product**. 1. Enter a **Name** for the product. 1. (Optional) Add a **Description**. The description appears at checkout, on the [customer portal](https://docs.stripe.com/customer-management.md), and in [quotes](https://docs.stripe.com/quotes.md). Next, create the monthly price for the product: 1. Click **More pricing options**. 1. Select **Recurring**. 1. For **Choose your pricing model**, select **Tiered pricing** and **Volume**. 1. Under **Price**, create three tiers: | | First unit | Last unit | Per unit | Flat fee | | ----------- | ---------- | --------- | -------- | -------- | | First tier | 1 | 5 | $7.00 | $0.00 | | Second tier | 6 | 10 | $6.50 | $0.00 | | Third tier | 11 | ∞ | $6.00 | $0.00 | 1. For **Billing period**, select **Monthly**. 1. Click **Add product** to save the product and price. You can only edit the product and price until you create a subscription with them. Create the tiers to match the example and set the value of `tiers_mode` to `volume`: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Nickname = "Project Volume Pricing", Tiers = new List { new PriceTierOptions { UnitAmount = 700, UpTo = 5 }, new PriceTierOptions { UnitAmount = 650, UpTo = 10 }, new PriceTierOptions { UnitAmount = 600, UpTo = PriceTierUpTo.Inf }, }, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "month", UsageType = "metered" }, Product = "<>", TiersMode = "volume", BillingScheme = "tiered", Expand = new List { "tiers" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Nickname: stripe.String("Project Volume Pricing"), Tiers: []*stripe.PriceTierParams{ &stripe.PriceTierParams{UnitAmount: stripe.Int64(700), UpTo: stripe.Int64(5)}, &stripe.PriceTierParams{UnitAmount: stripe.Int64(650), UpTo: stripe.Int64(10)}, &stripe.PriceTierParams{UnitAmount: stripe.Int64(600), UpToInf: stripe.String("inf")}, }, Currency: stripe.String(string(stripe.CurrencyUSD)), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), UsageType: stripe.String(string(stripe.PriceRecurringUsageTypeMetered)), }, Product: stripe.String("<>"), TiersMode: stripe.String(string(stripe.PriceTiersModeVolume)), BillingScheme: stripe.String(string(stripe.PriceBillingSchemeTiered)), }; params.AddExpand("tiers") result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setNickname("Project Volume Pricing") .addTier(PriceCreateParams.Tier.builder().setUnitAmount(700L).setUpTo(5L).build()) .addTier(PriceCreateParams.Tier.builder().setUnitAmount(650L).setUpTo(10L).build()) .addTier( PriceCreateParams.Tier.builder() .setUnitAmount(600L) .setUpTo(PriceCreateParams.Tier.UpTo.INF) .build() ) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .setUsageType(PriceCreateParams.Recurring.UsageType.METERED) .build() ) .setProduct("<>") .setTiersMode(PriceCreateParams.TiersMode.VOLUME) .setBillingScheme(PriceCreateParams.BillingScheme.TIERED) .addExpand("tiers") .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ nickname: 'Project Volume Pricing', tiers: [ { unit_amount: 700, up_to: 5, }, { unit_amount: 650, up_to: 10, }, { unit_amount: 600, up_to: 'inf', }, ], currency: 'usd', recurring: { interval: 'month', usage_type: 'metered', }, product: '<>', tiers_mode: 'volume', billing_scheme: 'tiered', expand: ['tiers'], }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( nickname="Project Volume Pricing", tiers=[ {"unit_amount": 700, "up_to": 5}, {"unit_amount": 650, "up_to": 10}, {"unit_amount": 600, "up_to": "inf"}, ], currency="usd", recurring={"interval": "month", "usage_type": "metered"}, product="<>", tiers_mode="volume", billing_scheme="tiered", expand=["tiers"], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'nickname' => 'Project Volume Pricing', 'tiers' => [ [ 'unit_amount' => 700, 'up_to' => 5, ], [ 'unit_amount' => 650, 'up_to' => 10, ], [ 'unit_amount' => 600, 'up_to' => 'inf', ], ], 'currency' => 'usd', 'recurring' => [ 'interval' => 'month', 'usage_type' => 'metered', ], 'product' => '<>', 'tiers_mode' => 'volume', 'billing_scheme' => 'tiered', 'expand' => ['tiers'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ nickname: 'Project Volume Pricing', tiers: [ { unit_amount: 700, up_to: 5, }, { unit_amount: 650, up_to: 10, }, { unit_amount: 600, up_to: 'inf', }, ], currency: 'usd', recurring: { interval: 'month', usage_type: 'metered', }, product: '<>', tiers_mode: 'volume', billing_scheme: 'tiered', expand: ['tiers'], }) ``` ### Graduated pricing While similar to volume pricing, graduated pricing charges for the usage in each tier instead of applying a single price for overall usage. The `quantity` is multiplied by the amount for each tier and the totals for each tier are summed together. For example, 5 projects result in the same charge as volume-based pricing—35 USD total at 7 USD per project. This changes as usage exceeds the first tier. A customer with more than 5 projects is charged 7 USD per project for the first 5 projects, then 6.50 USD for projects 6 through 10, and finally 6 USD per project thereafter. A customer with 6 projects is charged 41.50 USD, 35 USD for the first 5 projects and 6.50 USD for the 6th project. | Quantity and usage at end of the period | Total for graduated tiered pricing | | --------------------------------------- | ---------------------------------- | | 1 | 7 USD | | 5 | 35 USD | | 6 | 41.50 USD | | 20 | 127.50 USD | | 25 | 157.50 USD | 1. Go to the [Product catalog](https://dashboard.stripe.com/products). 1. Click **+ Create product**. 1. Enter a **Name** for the product. 1. (Optional) Add a **Description**. The description appears at checkout, on the [customer portal](https://docs.stripe.com/customer-management.md), and in [quotes](https://docs.stripe.com/quotes.md). Next, create the monthly price for the product: 1. Click **More pricing options**. 1. Select **Recurring**. 1. For **Choose your pricing model**, select **Tiered pricing** and **Graduated**. 1. Under **Price**, create three tiers: | | First unit | Last unit | Per unit | Flat fee | | ----------- | ---------- | --------- | -------- | -------- | | First tier | 1 | 5 | $7.00 | $0.00 | | Second tier | 6 | 10 | $6.50 | $0.00 | | Third tier | 11 | ∞ | $6.00 | $0.00 | 1. For the **Billing period**, select **Monthly**. 1. Click **Add product** to save the product and price. You can only edit the product and price until you create a subscription with them. Create the tiers to match the example and set the value of `tiers_mode` to `graduated`: ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Nickname = "Per-minute pricing", Tiers = new List { new PriceTierOptions { UnitAmount = 700, UpTo = 5 }, new PriceTierOptions { UnitAmount = 650, UpTo = 10 }, new PriceTierOptions { UnitAmount = 600, UpTo = PriceTierUpTo.Inf }, }, Currency = "usd", Recurring = new PriceRecurringOptions { Interval = "month", UsageType = "metered" }, Product = "<>", TiersMode = "graduated", BillingScheme = "tiered", Expand = new List { "tiers" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Nickname: stripe.String("Per-minute pricing"), Tiers: []*stripe.PriceTierParams{ &stripe.PriceTierParams{UnitAmount: stripe.Int64(700), UpTo: stripe.Int64(5)}, &stripe.PriceTierParams{UnitAmount: stripe.Int64(650), UpTo: stripe.Int64(10)}, &stripe.PriceTierParams{UnitAmount: stripe.Int64(600), UpToInf: stripe.String("inf")}, }, Currency: stripe.String(string(stripe.CurrencyUSD)), Recurring: &stripe.PriceRecurringParams{ Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), UsageType: stripe.String(string(stripe.PriceRecurringUsageTypeMetered)), }, Product: stripe.String("<>"), TiersMode: stripe.String(string(stripe.PriceTiersModeGraduated)), BillingScheme: stripe.String(string(stripe.PriceBillingSchemeTiered)), }; params.AddExpand("tiers") result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setNickname("Per-minute pricing") .addTier(PriceCreateParams.Tier.builder().setUnitAmount(700L).setUpTo(5L).build()) .addTier(PriceCreateParams.Tier.builder().setUnitAmount(650L).setUpTo(10L).build()) .addTier( PriceCreateParams.Tier.builder() .setUnitAmount(600L) .setUpTo(PriceCreateParams.Tier.UpTo.INF) .build() ) .setCurrency("usd") .setRecurring( PriceCreateParams.Recurring.builder() .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .setUsageType(PriceCreateParams.Recurring.UsageType.METERED) .build() ) .setProduct("<>") .setTiersMode(PriceCreateParams.TiersMode.GRADUATED) .setBillingScheme(PriceCreateParams.BillingScheme.TIERED) .addExpand("tiers") .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ nickname: 'Per-minute pricing', tiers: [ { unit_amount: 700, up_to: 5, }, { unit_amount: 650, up_to: 10, }, { unit_amount: 600, up_to: 'inf', }, ], currency: 'usd', recurring: { interval: 'month', usage_type: 'metered', }, product: '<>', tiers_mode: 'graduated', billing_scheme: 'tiered', expand: ['tiers'], }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( nickname="Per-minute pricing", tiers=[ {"unit_amount": 700, "up_to": 5}, {"unit_amount": 650, "up_to": 10}, {"unit_amount": 600, "up_to": "inf"}, ], currency="usd", recurring={"interval": "month", "usage_type": "metered"}, product="<>", tiers_mode="graduated", billing_scheme="tiered", expand=["tiers"], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'nickname' => 'Per-minute pricing', 'tiers' => [ [ 'unit_amount' => 700, 'up_to' => 5, ], [ 'unit_amount' => 650, 'up_to' => 10, ], [ 'unit_amount' => 600, 'up_to' => 'inf', ], ], 'currency' => 'usd', 'recurring' => [ 'interval' => 'month', 'usage_type' => 'metered', ], 'product' => '<>', 'tiers_mode' => 'graduated', 'billing_scheme' => 'tiered', 'expand' => ['tiers'], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ nickname: 'Per-minute pricing', tiers: [ { unit_amount: 700, up_to: 5, }, { unit_amount: 650, up_to: 10, }, { unit_amount: 600, up_to: 'inf', }, ], currency: 'usd', recurring: { interval: 'month', usage_type: 'metered', }, product: '<>', tiers_mode: 'graduated', billing_scheme: 'tiered', expand: ['tiers'], }) ``` ### Add a flat fee You can specify a flat fee (`flat_amount`) to add to the *invoice*. This works for both volume and graduated pricing. For example, you can have a flat fee that increases when your customer exceeds certain usage thresholds: | Tier | Amount (unit cost) | Flat fee | | ------------------ | -------------------------- | --------------------------- | | 1-5 (`up_to=5`) | 5 USD (`unit_amount=500`) | 10 USD (`flat_amount=1000`) | | 6-10 (`up_to=10`) | 4 USD (`unit_amount=400`) | 20 USD (`flat_amount=2000`) | | 10-15 (`up_to=15`) | 3 USD (`unit_amount=300`) | 30 USD (`flat_amount=3000`) | | 15-20 (`up_to=20`) | 2 USD (`unit_amount=200`) | 40 USD (`flat_amount=4000`) | | 20+ (`up_to=inf`) | 1 USD (`unit_amount=100`) | 50 USD (`flat_amount=5000`) | #### Volume-based pricing flat fee example If `quantity` is `12` and `tiers_mode=volume`, the total amount billed is: 12 × 3 USD + 30 USD = 66 USD #### Graduated pricing flat fee example If `quantity` is `12` and `tiers_mode=graduated`, the total amount billed is: (5 × 5 USD + 10 USD) + (5 × 4 USD + 20 USD) + (2 × 3 USD + 30 USD) = 111 USD A tier can have either a `unit_amount` or a `flat_amount`, or both, but it must have at least one of the two. If `quantity` is `0`, the total amount is `10 USD` regardless of the tiered pricing model used. Stripe always bills the first flat fee tier when `quantity=0`. To bill `0` when there’s no usage, set up an `up_to=1` tier with an `unit_amount` equal to the flat fee and omit the `flat_amount`. ## Usage-based pricing Usage-based pricing enables you to charge based on a customer’s usage of your product or service. Usage-based pricing includes models such as fixed fee and overage, pay as you go, and credit burndown. ### Fixed fee and overage Use the fixed fee and overage model to charge a flat fee per month for your service at the beginning of the period. The flat fee has some included usage entitlement, and any additional usage (overage) charges at the end of the period. You can use the Stripe Dashboard or API to set this up with two prices within the same product. For example, Alpaca AI introduces an advanced model called Llama AI. Priced at 200 USD per month, this model includes 100,000 tokens. They charge any usage above the included tokens at an additional rate of 0.001 USD per token. 1. On the [Product catalog](https://dashboard.stripe.com/test/products) page, click **Create product**. 1. On the **Add a product** page, do the following: - For **Name**, enter the name of your product. For the Alpaca AI example, enter “Llama AI.” - (Optional) For **Description**, add a description that appears at checkout in the [customer portal](https://docs.stripe.com/customer-management.md) and in [quotes](https://docs.stripe.com/quotes.md). - Under **Billing period**, select **More pricing options**. 1. On the **Add price** page, do the following: - Under **Choose your pricing model**, select **Flat rate**. - Under **Price**, set the **Amount** to `200.00 USD`. - Click **Next** 1. To add a second recurring price to the product, click **Add another price** on the **Add a product** page. 1. On the **Add price** page,do the following: - Under **Choose your pricing model**, select **Usage-based**, **Per tier**, and **Graduated**. - Under **Price**, create two graduated pricing tiers: | | First unit | Last unit | Per unit | Flat fee | | ----------- | ---------- | --------- | --------- | -------- | | First tier | 0 | 100,000 | 0.00 USD | 0.00 USD | | Second tier | 100,001 | ∞ | 0.001 USD | 0.00 USD | 1. Under **Meter**, create a new meter to record usage. For the Alpaca AI example, use the meter name “llama_api_tokens.” 1. Click **Next**. 1. Click **Add product**. When you create subscriptions, specify both prices. First, create your [product](https://docs.stripe.com/api/products.md). For the Alpaca AI example, use the name `Alpaca AI tokens`. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new ProductCreateOptions { Name = "Alpaca AI tokens" }; var service = new ProductService(); Product product = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.ProductParams{Name: stripe.String("Alpaca AI tokens")}; result, err := product.New(params); ``` ```java Stripe.apiKey = "<>"; ProductCreateParams params = ProductCreateParams.builder().setName("Alpaca AI tokens").build(); Product product = Product.create(params); ``` ```node const stripe = require('stripe')('<>'); const product = await stripe.products.create({ name: 'Alpaca AI tokens', }); ``` ```python import stripe stripe.api_key = "<>" product = stripe.Product.create(name="Alpaca AI tokens") ``` ```php $stripe = new \Stripe\StripeClient('<>'); $product = $stripe->products->create(['name' => 'Alpaca AI tokens']); ``` ```ruby Stripe.api_key = '<>' product = Stripe::Product.create({name: 'Alpaca AI tokens'}) ``` Next, add a flat fee [price](https://docs.stripe.com/api/prices.md) to the product with a licensed rate of 200 USD. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new PriceCreateOptions { Product = "{{PRODUCT_ID}}", Currency = "usd", UnitAmount = 20000, BillingScheme = "per_unit", Recurring = new PriceRecurringOptions { UsageType = "licensed", Interval = "month" }, }; var service = new PriceService(); Price price = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.PriceParams{ Product: stripe.String("{{PRODUCT_ID}}"), Currency: stripe.String(string(stripe.CurrencyUSD)), UnitAmount: stripe.Int64(20000), BillingScheme: stripe.String(string(stripe.PriceBillingSchemePerUnit)), Recurring: &stripe.PriceRecurringParams{ UsageType: stripe.String(string(stripe.PriceRecurringUsageTypeLicensed)), Interval: stripe.String(string(stripe.PriceRecurringIntervalMonth)), }, }; result, err := price.New(params); ``` ```java Stripe.apiKey = "<>"; PriceCreateParams params = PriceCreateParams.builder() .setProduct("{{PRODUCT_ID}}") .setCurrency("usd") .setUnitAmount(20000L) .setBillingScheme(PriceCreateParams.BillingScheme.PER_UNIT) .setRecurring( PriceCreateParams.Recurring.builder() .setUsageType(PriceCreateParams.Recurring.UsageType.LICENSED) .setInterval(PriceCreateParams.Recurring.Interval.MONTH) .build() ) .build(); Price price = Price.create(params); ``` ```node const stripe = require('stripe')('<>'); const price = await stripe.prices.create({ product: '{{PRODUCT_ID}}', currency: 'usd', unit_amount: 20000, billing_scheme: 'per_unit', recurring: { usage_type: 'licensed', interval: 'month', }, }); ``` ```python import stripe stripe.api_key = "<>" price = stripe.Price.create( product="{{PRODUCT_ID}}", currency="usd", unit_amount=20000, billing_scheme="per_unit", recurring={"usage_type": "licensed", "interval": "month"}, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $price = $stripe->prices->create([ 'product' => '{{PRODUCT_ID}}', 'currency' => 'usd', 'unit_amount' => 20000, 'billing_scheme' => 'per_unit', 'recurring' => [ 'usage_type' => 'licensed', 'interval' => 'month', ], ]); ``` ```ruby Stripe.api_key = '<>' price = Stripe::Price.create({ product: '{{PRODUCT_ID}}', currency: 'usd', unit_amount: 20000, billing_scheme: 'per_unit', recurring: { usage_type: 'licensed', interval: 'month', }, }) ``` Then, add a metered price to the product with a graduated rate with two tiers. For the first tier, specify 0 to 100,000 units at 200 USD. For the second tier, specify 0.001 USD per unit. The first tier has a price of 0 USD because the flat rate includes the first 100,000 units. Finally, specify both price IDs when you [create a subscription](https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide.md#create-subscription). ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new SubscriptionCreateOptions { Customer = "{{CUSTOMER_ID}}", Items = new List { new SubscriptionItemOptions { Price = "{{FLAT_MONTHLY_FEE_PRICE_ID}}", Quantity = 1 }, new SubscriptionItemOptions { Price = "{{METERED_USAGE_PRICE_ID}}" }, }, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.SubscriptionParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), Items: []*stripe.SubscriptionItemsParams{ &stripe.SubscriptionItemsParams{ Price: stripe.String("{{FLAT_MONTHLY_FEE_PRICE_ID}}"), Quantity: stripe.Int64(1), }, &stripe.SubscriptionItemsParams{Price: stripe.String("{{METERED_USAGE_PRICE_ID}}")}, }, }; result, err := subscription.New(params); ``` ```java Stripe.apiKey = "<>"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .addItem( SubscriptionCreateParams.Item.builder() .setPrice("{{FLAT_MONTHLY_FEE_PRICE_ID}}") .setQuantity(1L) .build() ) .addItem(SubscriptionCreateParams.Item.builder().setPrice("{{METERED_USAGE_PRICE_ID}}").build()) .build(); Subscription subscription = Subscription.create(params); ``` ```node const stripe = require('stripe')('<>'); const subscription = await stripe.subscriptions.create({ customer: '{{CUSTOMER_ID}}', items: [ { price: '{{FLAT_MONTHLY_FEE_PRICE_ID}}', quantity: 1, }, { price: '{{METERED_USAGE_PRICE_ID}}', }, ], }); ``` ```python import stripe stripe.api_key = "<>" subscription = stripe.Subscription.create( customer="{{CUSTOMER_ID}}", items=[ {"price": "{{FLAT_MONTHLY_FEE_PRICE_ID}}", "quantity": 1}, {"price": "{{METERED_USAGE_PRICE_ID}}"}, ], ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $subscription = $stripe->subscriptions->create([ 'customer' => '{{CUSTOMER_ID}}', 'items' => [ [ 'price' => '{{FLAT_MONTHLY_FEE_PRICE_ID}}', 'quantity' => 1, ], ['price' => '{{METERED_USAGE_PRICE_ID}}'], ], ]); ``` ```ruby Stripe.api_key = '<>' subscription = Stripe::Subscription.create({ customer: '{{CUSTOMER_ID}}', items: [ { price: '{{FLAT_MONTHLY_FEE_PRICE_ID}}', quantity: 1, }, {price: '{{METERED_USAGE_PRICE_ID}}'}, ], }) ``` ### Pay as you go The pay as you go model (also called “in arrears billing”) lets you track usage incurred over a determined period, then charge the customer at the end of the period. You can use rate cards to set up the pay as you go model. Rate cards are currently in [private preview](https://docs.stripe.com/release-phases.md). to request access. You can use any of the following pricing strategies: - **Per unit**: Charge the same amount for each unit. - **Per package**: Charge an amount for a package or bundle of units or usage. - **Volume-based pricing**: Charge the subscription item at the tier that corresponds to the usage amount at the end of the period. - **Graduated pricing**: Charge for the usage in each tier instead of applying a single price to all usage. This model might cause customers to accumulate significant usage, and affect their payment method status at the end of the month. ### Credit burndown The credit burndown model lets you collect prepayment for usage-based products and services. Customers can use [billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits.md) to pay an initial amount, and then apply their billing credits as they use the product. You can use rate cards to set up the pay as you go model. Rate cards are currently in [private preview](https://docs.stripe.com/release-phases.md). to request access. For example, Alpaca AI wants to sell a large enterprise contract to an existing self-serve customer for their new Llama AI Model. The customer commits to pay 100,000 USD up front for Llama AI, so they can get 120,000 USD of billing credit usage to use within 1 year. #### Collect prepayment from a customer 1. On the [Invoices](https://dashboard.stripe.com/invoices) page, click **Create invoice**. 1. Select your customer from the **Customer** dropdown. 1. Select **USD - US Dollar** from the **Currency** dropdown. 1. Under **Items**, select **Add a new line item**. 1. Under **Item details**, do the following: - For **Item**, enter “Llama AI Credits.” - For **Price**, enter “100,000.” - Click **Save**. 1. Click **Send invoice**. After your customer pays the invoice, you can grant them billing credits. #### Grant billing credits to a customer 1. On the [Customers](https://dashboard.stripe.com/test/customers) page, select the customer name. 1. On the customer page, under **Credit grants**, click the plus (**+**) symbol. 1. On the **New credit grant** page, do the following: - For **Name**, enter a name for your credit grant. - For **Amount**, specify the amount of the credit grant. For the Alpaca AI example, enter “120,000.” - Under **Expiry date**, specify the date, if any, when the credits expire. For the Alpaca AI example, select **Specific date** and set a date 12 months from now. - Click **Create grant**. First, create an invoice. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceCreateOptions { Description = "Alpaca AI Credits", Customer = "{{CUSTOMER_ID}}", CollectionMethod = "charge_automatically", }; var service = new InvoiceService(); Invoice invoice = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceParams{ Description: stripe.String("Alpaca AI Credits"), Customer: stripe.String("{{CUSTOMER_ID}}"), CollectionMethod: stripe.String(string(stripe.InvoiceCollectionMethodChargeAutomatically)), }; result, err := invoice.New(params); ``` ```java Stripe.apiKey = "<>"; InvoiceCreateParams params = InvoiceCreateParams.builder() .setDescription("Alpaca AI Credits") .setCustomer("{{CUSTOMER_ID}}") .setCollectionMethod(InvoiceCreateParams.CollectionMethod.CHARGE_AUTOMATICALLY) .build(); Invoice invoice = Invoice.create(params); ``` ```node const stripe = require('stripe')('<>'); const invoice = await stripe.invoices.create({ description: 'Alpaca AI Credits', customer: '{{CUSTOMER_ID}}', collection_method: 'charge_automatically', }); ``` ```python import stripe stripe.api_key = "<>" invoice = stripe.Invoice.create( description="Alpaca AI Credits", customer="{{CUSTOMER_ID}}", collection_method="charge_automatically", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoice = $stripe->invoices->create([ 'description' => 'Alpaca AI Credits', 'customer' => '{{CUSTOMER_ID}}', 'collection_method' => 'charge_automatically', ]); ``` ```ruby Stripe.api_key = '<>' invoice = Stripe::Invoice.create({ description: 'Alpaca AI Credits', customer: '{{CUSTOMER_ID}}', collection_method: 'charge_automatically', }) ``` Next, add the billing credits to the invoice. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceItemCreateOptions { Customer = "{{CUSTOMER_ID}}", Currency = "usd", UnitAmountDecimal = 10000000M, }; var service = new InvoiceItemService(); InvoiceItem invoiceItem = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceItemParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), Currency: stripe.String(string(stripe.CurrencyUSD)), UnitAmountDecimal: stripe.Float64(10000000), }; result, err := invoiceitem.New(params); ``` ```java Stripe.apiKey = "<>"; InvoiceItemCreateParams params = InvoiceItemCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setCurrency("usd") .setUnitAmountDecimal(new BigDecimal("10000000")) .build(); InvoiceItem invoiceItem = InvoiceItem.create(params); ``` ```node const stripe = require('stripe')('<>'); const invoiceItem = await stripe.invoiceItems.create({ customer: '{{CUSTOMER_ID}}', currency: 'usd', unit_amount_decimal: '10000000', }); ``` ```python import stripe stripe.api_key = "<>" invoice_item = stripe.InvoiceItem.create( customer="{{CUSTOMER_ID}}", currency="usd", unit_amount_decimal="10000000", ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoiceItem = $stripe->invoiceItems->create([ 'customer' => '{{CUSTOMER_ID}}', 'currency' => 'usd', 'unit_amount_decimal' => '10000000', ]); ``` ```ruby Stripe.api_key = '<>' invoice_item = Stripe::InvoiceItem.create({ customer: '{{CUSTOMER_ID}}', currency: 'usd', unit_amount_decimal: '10000000', }) ``` Then, finalize the invoice. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new InvoiceFinalizeOptions { AutoAdvance = true }; var service = new InvoiceService(); Invoice invoice = service.FinalizeInvoice("{{INVOICE_ID}}", options); ``` ```go stripe.Key = "<>" params := &stripe.InvoiceFinalizeInvoiceParams{AutoAdvance: stripe.Bool(true)}; result, err := invoice.FinalizeInvoice("{{INVOICE_ID}}", params); ``` ```java Stripe.apiKey = "<>"; Invoice resource = Invoice.retrieve("{{INVOICE_ID}}"); InvoiceFinalizeInvoiceParams params = InvoiceFinalizeInvoiceParams.builder().setAutoAdvance(true).build(); Invoice invoice = resource.finalizeInvoice(params); ``` ```node const stripe = require('stripe')('<>'); const invoice = await stripe.invoices.finalizeInvoice( '{{INVOICE_ID}}', { auto_advance: true, } ); ``` ```python import stripe stripe.api_key = "<>" invoice = stripe.Invoice.finalize_invoice( "{{INVOICE_ID}}", auto_advance=True, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $invoice = $stripe->invoices->finalizeInvoice('{{INVOICE_ID}}', ['auto_advance' => true]); ``` ```ruby Stripe.api_key = '<>' invoice = Stripe::Invoice.finalize_invoice('{{INVOICE_ID}}', {auto_advance: true}) ``` After your customer pays the invoice, you can grant them billing credits. ```dotnet StripeConfiguration.ApiKey = "<>"; var options = new Stripe.Billing.CreditGrantCreateOptions { Customer = "{{CUSTOMER_ID}}", Category = "paid", Amount = new Stripe.Billing.CreditGrantAmountOptions { Type = "monetary", Monetary = new Stripe.Billing.CreditGrantAmountMonetaryOptions { Value = 12000000, Currency = "usd", }, }, ApplicabilityConfig = new Stripe.Billing.CreditGrantApplicabilityConfigOptions { Scope = new Stripe.Billing.CreditGrantApplicabilityConfigScopeOptions { PriceType = "metered", }, }, ExpiresAt = DateTimeOffset.FromUnixTimeSeconds(1759341179).UtcDateTime, }; var service = new Stripe.Billing.CreditGrantService(); Stripe.Billing.CreditGrant creditGrant = service.Create(options); ``` ```go stripe.Key = "<>" params := &stripe.BillingCreditGrantParams{ Customer: stripe.String("{{CUSTOMER_ID}}"), Category: stripe.String(string(stripe.BillingCreditGrantCategoryPaid)), Amount: &stripe.BillingCreditGrantAmountParams{ Type: stripe.String("monetary"), Monetary: &stripe.BillingCreditGrantAmountMonetaryParams{ Value: stripe.Int64(12000000), Currency: stripe.String(string(stripe.CurrencyUSD)), }, }, ApplicabilityConfig: &stripe.BillingCreditGrantApplicabilityConfigParams{ Scope: &stripe.BillingCreditGrantApplicabilityConfigScopeParams{ PriceType: stripe.String("metered"), }, }, ExpiresAt: stripe.Int64(1759341179), }; result, err := creditgrant.New(params); ``` ```java Stripe.apiKey = "<>"; CreditGrantCreateParams params = CreditGrantCreateParams.builder() .setCustomer("{{CUSTOMER_ID}}") .setCategory(CreditGrantCreateParams.Category.PAID) .setAmount( CreditGrantCreateParams.Amount.builder() .setType(CreditGrantCreateParams.Amount.Type.MONETARY) .setMonetary( CreditGrantCreateParams.Amount.Monetary.builder() .setValue(12000000L) .setCurrency("usd") .build() ) .build() ) .setApplicabilityConfig( CreditGrantCreateParams.ApplicabilityConfig.builder() .setScope( CreditGrantCreateParams.ApplicabilityConfig.Scope.builder() .setPriceType(CreditGrantCreateParams.ApplicabilityConfig.Scope.PriceType.METERED) .build() ) .build() ) .setExpiresAt(1759341179L) .build(); CreditGrant creditGrant = CreditGrant.create(params); ``` ```node const stripe = require('stripe')('<>'); const creditGrant = await stripe.billing.creditGrants.create({ customer: '{{CUSTOMER_ID}}', category: 'paid', amount: { type: 'monetary', monetary: { value: 12000000, currency: 'usd', }, }, applicability_config: { scope: { price_type: 'metered', }, }, expires_at: 1759341179, }); ``` ```python import stripe stripe.api_key = "<>" credit_grant = stripe.billing.CreditGrant.create( customer="{{CUSTOMER_ID}}", category="paid", amount={"type": "monetary", "monetary": {"value": 12000000, "currency": "usd"}}, applicability_config={"scope": {"price_type": "metered"}}, expires_at=1759341179, ) ``` ```php $stripe = new \Stripe\StripeClient('<>'); $creditGrant = $stripe->billing->creditGrants->create([ 'customer' => '{{CUSTOMER_ID}}', 'category' => 'paid', 'amount' => [ 'type' => 'monetary', 'monetary' => [ 'value' => 12000000, 'currency' => 'usd', ], ], 'applicability_config' => ['scope' => ['price_type' => 'metered']], 'expires_at' => 1759341179, ]); ``` ```ruby Stripe.api_key = '<>' credit_grant = Stripe::Billing::CreditGrant.create({ customer: '{{CUSTOMER_ID}}', category: 'paid', amount: { type: 'monetary', monetary: { value: 12000000, currency: 'usd', }, }, applicability_config: {scope: {price_type: 'metered'}}, expires_at: 1759341179, }) ``` ## See Also - [Prebuilt subscriptions page with Stripe Checkout](https://docs.stripe.com/billing/quickstart.md) - [Build a subscriptions integration](https://docs.stripe.com/billing/subscriptions/build-subscriptions.md) - [Embed a pricing table](https://docs.stripe.com/payments/checkout/pricing-table.md)