Set up a flat fee and overages pricing model
Charge customers a flat rate with the option to pay for additional usage in arrears.
Flat fee with overages combines predictable billing with the flexibility to scale. Customers pay a set recurring fee for a base package, and any usage beyond that limit is billed separately. This model works well if you want steady, reliable revenue while still giving customers room to grow. The base fee covers core value, while overages ensure that heavy users pay in proportion to what they consume. For example, if you run a video hosting platform, you might include 1,000 monthly video streams in a 200 USD flat fee. If a customer streams more than that, each additional stream is billed as an overage. At the end of the month, Stripe sends an invoice that combines the flat fee with any usage above the included limit, automatically charging the customer’s payment method on file or prompting them to add one.
What you’ll build
In this guide, build a flat fee and overages pricing model for a fictional company called Alpaca.ai, which provides LLM. They charge customers at the following rates:
License | Fee |
---|---|
Per user | 100 USD |
Usage | Fee |
---|---|
0-1000 | 0 USD |
1000+ | 0.04 USD |
To implement this model, you create meters to record the usage, products and prices to represent your service, a customer, and a customer subscription.
Create a meter
Meters specify how to aggregate meter events over a billing period. Meter events represent all actions that customers take in your system (for example, API requests). Meters attach to prices and form the basis of what’s billed.
For the Alpaca AI example, meter events are the number of tokens a customer uses in a query. The meter is the sum of tokens over a month.
You can use the Stripe Dashboard or API to configure a meter. To use the API with the Stripe CLI to create a meter, get started with the Stripe CLI.
Create a pricing model
Use the Stripe Dashboard or API to create a pricing model that includes your Products and their pricing options. Prices define the unit cost, currency, and billing period.
For the Alpaca AI example, you create a product with a metered price of 0.04 USD per hundred units, billed at a monthly interval. Use the meter that you created in the previous step.
Next, create the 100 USD monthly fee.
Create a customer
Next, create a customer.
Create a subscription
Subscriptions allow you to charge recurring amounts by associating a customer with a specific price.
Use the Stripe Dashboard or API to create a subscription that includes your customer, product, and usage-based price.
For the Alpaca AI example, you create a subscription for the Alpaca AI usage product and Alpaca AI license fee product.
Note
You can associate a single metered price with one or more subscriptions.
When you create a billing_
subscription, Stripe excludes metered line items from the first invoice since no prior usage exists to bill. Stripe creates an invoice only if the subscription is backdated with previously accrued usage or if pending invoice items exist. When you create a billing_
subscription, Stripe generates a zero monetary value invoice line item for each metered subscription item.
Send a test meter event
Use Meter Events to record customer usage for your meter. At the end of the billing period, Stripe bills the reported usage.
You can test your usage-based billing by sending a meter event through the Stripe Dashboard or API. When using the API, specify the customer ID and value for the payload
.
After you send meter events, you can view usage details for your meter on the Meters page in the Dashboard.
Create a preview invoice
Create a preview invoice to see a preview of a customer’s invoice that includes details such as the meter price and usage quantity.
OptionalRetrieve usage for a custom time period
Use the Meter Event Summary to retrieve total usage for a custom time period. The meter event summary returns a customer’s aggregated usage for a period, based on the aggregation formula defined by the meter.
In the Alpaca AI example, the meter event summary returns the sum of tokens for a specific customer, meter, and time window.
Because Stripe processes meter events asynchronously, meter event summaries might not immediately reflect recently received meter events.