Metered pricing is a common method of billing for many B2B SaaS businesses. You might be launching your product or updating your pricing model to a per-usage model. This guide will help you design the most efficient metered billing architecture using Stripe Billing.

To keep it simple, I'll use Browserless' usage pricing model of $0.00015 per second of browser testing. Users can sign up to the app, use the automated browser testing tool, and the app will record each second of usage. The total amount of usage will then get charged to the user's card at the end of the month. Let's start by modeling the user acquisition flow.
Design your sign up flow
The metered pricing model typically follows the principles of the freemium user acquisition strategy. Here is the standard flow:
The user views the public pricing page. They register for the app without any friction. They get an option to input their credit card or skip to the setup process. Once they use the platform, their usage gets recorded, and the app forces the user to input the credit card. Once the user uses the app and pays, they can manage their subscription, update card, download invoices, or cancel using a customer portal.
Once you've finalized your onboarding flow, it's time to model your pricing model in Stripe.
Model your metered prices in Stripe
Stripe Billing, the subscription billing product of Stripe, lets you create pricing models by creating products and prices within them using the admin dashboard. For this billing example of $0.00015 per second usage pricing, we need just one product and one price. Stripe allows prices to cost a fraction of a cent!
Once you check the metered checkbox, you can pick a metered usage behavior. This feature allows you to define how you want usage calculated after you record each usage. There are four standard ways of calculating usage:

- Sum of usage values during period: Charges for the sum of the usage recorded throughout the billing cycle.
- Most recent usage value during period: Charges for the last usage recorded before the billing cycle ends.
- Most recent usage value: Charges for the last usage recorded throughout the subscription's life at the end of each billing cycle.
- Maximum usage value during period: Charges for the highest usage amount recorded during the billing cycle.
For our example pricing, we want to record the sum of usage values during the billing period.
Record usage of each user
For the billing system to charge the user at the end of each billing cycle, each user's usage should get recorded. Luckily, Stripe has made this a breeze with a single API call. Stripe's "Create a usage record" API call allows you to pass in the user's subscription item, timestamp of the usage, and quantity of use. Stripe will then handle all the billing calculations behind the scene and automatically charge the user at the end of the billing cycle. Make this API call through your app's back-end. Here is what the high-level flow of usage recording looks like:
The best practice is to pass the usage record to Stripe for each user's session in your app. This will allow you to run historical reports of the usage.
Let customers manage their subscription
Allowing users to manage their subscriptions after entering their credit card and using the app is a great way to reduce the billing support time. Your customers must be able to download invoices, update credit card when it expires or fails, and view their usage every month. This feature requires more front-end and back-end logic than the previous step for recording the usage. Luckily, the Stripe Billing ecosystem has some out-of-the-box solutions that can save you weeks or maybe months of development. There are two optimal ways to set up your customer portal with Stripe:
Stripe Billing customer portal
Stripe Billing has a hosted customer portal that you can use to build your initial billing portal. Stripe's documentation has a slick preview of this portal:

Billflow customer portal for Stripe Billing
For a more customized solution, you can use Billflow's embeddable customer portal billing page that can be placed inside your app and directly connected to your user authentication system.

Here is the live demo of Billflow's embedded customer portal:
Both these options work on top of Stripe and keep Stripe Billing as the single source of truth for your billing infrastructure.
Keep Stripe as the single source of truth
Stripe is known for its robust API and documentation. Keeping Stripe as the main dashboard to administrate billing and directly working with Stripe's API will help reduce friction as you scale your SaaS and experiment with pricing model adjustments. Stripe toolkits like Billflow can help you provide a customized customer-facing billing flow to your customers without any development effort.
Here is a quick demo video of the metered billing flow:
If you are looking for a Stripe Billing expert advice on your billing architecture, you can schedule a 30-minute call with me here.