By default, each subscription is for one product, but Stripe allows you to subscribe a customer to multiple quantities of an item. For example, say you run a hosting company that customers host sites through at a cost of 9.99 USD per site, per month. Most customers host a single site, while some host many. You could create prices for one site (9.99 USD), two sites (19.98 USD), and so forth, but a better approach is to subscribe customers to a quantity with a 9.99 USD unit price.
Subscriptions have two kinds of usage-based billing: 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 can only specify a quantity when creating a subscription with a
licensed. If you want to have granular billing for usage that fluctuates within a billing interval, consider using metered billing instead of quantities.
Setting multiple quantities
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.
When you bill your customers, you may want to track usage at a different granularity than you bill. For example, consider a productivity software suite that charges 10 USD for every 5 users (or portion thereof) using the product. Without quantity transformation, they would need to increase the
quantity of the subscription item by 1 for every 5 users.
Number of Users
Subscription Item Quantity Reported to Stripe
transform_quantity parameter, you can instruct Stripe to transform the quantity before applying the per unit cost. The following subscription allows you to naturally report the current number of users as the subscription item
quantity—Stripe’s billing system divides the quantity by 5 and rounds up before calculating by the unit cost.
Currently, the only available transformation is division, using the
divide_by parameter in conjunction with the
transform_quantity only works with
billing_scheme=per_unit. It is incompatible with tiered pricing.
The previous example showed a subscription that charges for every 5 users rounding up, i.e. 6 divided by 5 results in a quantity of 2. For use cases where you do not want to charge for a portion of usage, like charging for every full gigabyte of usage of a broadband internet service, you can also pass
down as the value of
You can also apply
transform_quantity in conjunction with metered billing. This transformation applies to prices with
recurring[usage_type]=metered at the end of a billing period in the same way it applies to
quantity for prices with
A marketing email service that creates a metered price to charge 0.10 USD for every full 1000 emails sent might look something like this:
With this subscription, usage can be reported per email and the customer is billed 0.10 USD for every 1000 emails they send.