- Risk-conscious startups seeking to eliminate payment defaults
- Established companies looking to reduce revenue leakage and churn
- Businesses operating in markets with higher fraud potential
Use case
In this guide, your customer Example Inc. signs up for your platform using Stripe as your billing provider. They purchase 2,000 credits to use on your platform, which expire after one year. When the Example Inc. user clickspurchase credits
in your system, payment is immediately triggered, and credits are only granted once payment is confirmed successful. With credits in hand, they can use your system and watch their credit balance decrease in real time. Once their balance reaches zero, your system should cut them off from further use until they purchase another batch of credits.
Metronome building blocks
Regardless of the commercial model you choose, Metronome’s core job is to turn usage data into accurate spend data. Before implementing the prepaid credit model, set up these core Metronome objects:- Billable metrics: Create a billable metric for each unit of what customers consume by using your platform (like compute, storage, or API calls).
- Product: Create a usage-based product for each of your billable metrics so you can configure how your usage spend appears to your users. Also create a fixed product to represent the credit-purchased charges.
- Rate card and rates: Create a rate card that contains the burn-down rates for each of the usage-based products that you plan to offer to your users.
Implement prepaid credits
After completing this guide, you’ll have a prepaid credits model built out in Metronome.
Set up a billing provider
Within the prepaid credit flow, Metronome facilitates payment from your billing provider to immediately charge customers and ensure that payments complete before credits are granted. As such, you first need to connect your billing provider to allow Metronome to send and finalize invoices on your behalf. The most common billing provider in the prepaid credits flow is Stripe. To learn how to connect your Stripe account, see Invoice with Stripe.Set up a webhook
The prepaid credits flow relies on your system receiving real-time webhook notifications from Metronome. These are used to send a signal:- When users run out of balance, so that your system can cut off their platform access
- Upon successful or failed payment, so that your system can enable or disable customers as needed
Configure the credit lifecycle
Implementing a prepaid credits model on Metronome involves taking steps at different parts of the purchase lifecycle.Customer sign-up
When a customer signs up in your application:- Ensure that you’ve created their customer record in Metronome and your billing provider (for example, Stripe).
- Start their contract to encode the rates that Metronome should use as customer usage events start to flow through the system.
- A user signs up for an account in your platform, entering their credit card information.
- You create the user as a customer in Stripe.
- You set their entered payment method as their default in Stripe.
- You create a customer in Metronome, linking the Stripe customer ID.
- You create a contract for the customer in Metronome.
TIPWe recommend configuring contracts with first of the month billing. While users won’t get billed in arrears in a prepaid credits model, using first of the month billing makes it easier to group spend revenue data by monthly boundaries.
customers
endpoint to create a customer, linking to the customer’s Stripe customer ID:
contracts/create
endpoint to create a contract:
false
.
Credit purchases
In a prepaid credits model, customers must have a positive credit balance to be able to use your system. To have a positive credit balance, they must purchase batches of credits. This is generally included in the initial sign-up flow, and customers then have the ability to purchase ad-hoc credits through your platform as needed. This flow should look like:- User clicks purchase credits in your platform with the desired amount.
-
You send an API request to Metronome to facilitate the end-to-end prepaid credit. Metronome initiates the payment in Stripe.
- Upon success, Metronome creates a commit object to increase the customer balance and sends a webhook with notice of a successful payment.
- Upon failure, Metronome voids the commit object in the system and sends a webhook with notice of a failed payment.
-
Upon successful payment, you set a customer’s entitlement state to
true
to allow them to start to spend.
contracts/edit
endpoint to facilitate the prepaid credit:
Manage entitlement
We recommend that a customer’s entitlement state is managed within your system and database. At its most simple, this could be a true/false value for a particular customer that’s checked before they take an action. We recommend that this is maintained within your system so that it can be fetched with the latency that your system will require, and so that it’s resilient to any failures between your system and Metronome. At a high level, when a customer action is taken, this is the state you should check:customer_entitled
to false
.
Optimize your customer’s experience
Use Metronome to offer experiences to your customers like automatic recharge and spend previews.Enable automatic recharge
You can offer automatic recharge to your customers. This allows them to automatically purchase more credits when a threshold is reached, ensuring that they never reach a $0 balance. For instance, a customer may opt to the following: when my balance reaches $5 remaining, recharge me back to $20. If implemented, they should expect increments of $15 credit purchases after the initial $20 purchase. You can set up a customer’s desired auto recharge threshold on their contract object. Once set up, Metronome handles all of the recharge actions asynchronously based on customer usage. To set this up, use thethreshold_billing_configuration
object within the create contract request:
is_enabled
to false
. To remediate, we recommend sending an email or in-platform notification to the customer prompting them to update their billing information. Upon update of this information, you should edit the contract and set is_enabled
back to true
, which triggers another recharge.
Present spend to your customers
As a customer’s experience with your platform changes when they run out of credits, you should give them the ability to see their balance updated in real time through your platform. The Metronome listBalances API supports these UI components. This API call shows how to fetch the balance for a particular customer: