Setting subscription quantities

    Vary a subscription’s cost by subscribing a customer to multiple quantities of a product.

    By default, each subscription is for one product, but Stripe allows you to subscribe a customer to multiple quantities of a single product. For example, say you run a hosting company through which customers host sites at a cost of $9.99 per site per month. Most customers host a single site, while some host many. You could create prices for one site ($9.99), two sites ($19.98), and so forth, but a better approach is to subscribe customers to a quantity with a $9.99 unit price.

    There are two kinds of usage-based billing for subscriptions: metered billing, and per-seat licensing. You can enable these billing models by setting the value of the recurring[usage_type] attribute when creating a price. You may only specify a quantity when creating a subscription configured with licensed as the value of recurring[usage_type]. If you would like to have granular billing for usage that fluctuates within a billing interval, consider using metered billing instead of quantities.

    Setting multiple quantities

    To set the quantity on a subscription, provide a quantity value when creating or updating the subscription:

    curl https://api.stripe.com/v1/subscriptions \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d "items[0][price]"=price_CBb6IXqvTLXp3f \ -d "items[0][quantity]"=5
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = Stripe::Subscription.create({ customer: 'cus_4fdAW5ftNQow1a', items: [ { price: 'price_CBb6IXqvTLXp3f', quantity: 5, }, ], })
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' subscription = stripe.Subscription.create( customer='cus_4fdAW5ftNQow1a', items=[ { 'price': 'price_CBb6IXqvTLXp3f', 'quantity': 5, }, ], )
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $subscription = \Stripe\Subscription::create([ 'customer' => 'cus_4fdAW5ftNQow1a', 'items' => [ [ 'price' => 'price_CBb6IXqvTLXp3f', 'quantity' => 5, ], ], ]);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; SubscriptionCreateParams params = SubscriptionCreateParams.builder() .setCustomer("cus_4fdAW5ftNQow1a") .addItem( SubscriptionCreateParams.Item.builder() .setPrice("price_CBb6IXqvTLXp3f") .setQuantity(5L) .build()) .build(); Subscription subscription = Subscription.create(params);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const subscription = await stripe.subscriptions.create({ customer: 'cus_4fdAW5ftNQow1a', items: [ { price: 'price_CBb6IXqvTLXp3f', quantity: 5, }, ], });
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" items := []*stripe.SubscriptionItemsParams{ { Price: stripe.String("price_CBb6IXqvTLXp3f"), Quantity: stripe.Int64(5), }, } params := &stripe.SubscriptionParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Items: items, } subscription, _ := sub.New(params)
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var items = new List<SubscriptionItemOptions> { new SubscriptionItemOptions { Price = "price_CBb6IXqvTLXp3f", Quantity = 5, } }; var options = new SubscriptionCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Items = items, }; var service = new SubscriptionService(); Subscription subscription = service.Create(options);

    Multiple quantities are still billed using one invoice, and are prorated when the subscription changes, including when you change just the quantities involved.

    Charging different amounts based on quantity

    In some cases, you may want to adjust the cost per seat based on the number of seats in a subscription. For example, you could offer volume licensing discounts for subscriptions that exceed certain quantity thresholds. You can use tiers to adjust per-seat pricing in that manner.

    Next steps

    Now that you understand how to use quantities, you may want to check out:

    Was this page helpful?

    Feedback about this page?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page