Usage-based billing recipes/Prepaid credits with rollover

Build a prepaid credit model end-to-end in Chargebee

Customers buy a balance of credits and spend it as they work. You get predictable, upfront revenue and a real-time view of what every account is consuming, with nothing leaking out unbilled. Here’s how to build it in Chargebee.

Model
Prepaid credits
Complexity
Medium
Building blocks
3
Reference
Lovable
Lovable · Pricinglovable.dev/pricing
Free
$0/mo
Pro
$25/mo
Business
$50/mo
Enterprise
Platform fee
Plan terms
Free
Pro
Business
Enterprise
Credits / month
Included
100
100
Volume-based
Credit rollover
No
1 month
1 month
Custom
On-demand top-ups
No
Yes
Yes
Custom
Governance
No
Roles
SSO
SCIM
Source: lovable.dev/pricing
Lovable's published pricing, shown for reference. The worked example used in this recipe is introduced in Set up below and is illustrative only.
The model

A spending budget for them. Cash up front for you.

A credit is one unit of value in your product: a build, a generation, or a run. Every action your customer takes debits the balance instantly, so the running total is always accurate.

At the start of each cycle, Chargebee grants a fresh balance. Unused credits roll forward to a set cap and then expire, and a top-up refills the pool whenever it runs low.

This works when
  • Customers want a spending ceiling they control, not an open-ended usage bill
  • A single action maps cleanly to one credit you can price and meter
  • Your per-action cost varies enough that flat seat pricing leaks margin
  • You want the cash before the usage, recognised as the balance is drawn down
The recipe

Here’s what you need

Three objects in the Chargebee catalog. Define them once and they carry the credit model through every deal and renewal.

1
PlanThe anchor
$30k/yr

The subscription tier the customer commits to, billed on a recurring cycle. The plan carries the monthly credit grant as a default that every new subscription inherits.

2
Credit unitValue metric
50,000/cycle

One value metric: ai_credits. Every grant, debit, and top-up is denominated in it. The grant quantity and the rollover policy both attach here: unused credits carry forward one cycle, then expire.

3
Top-up packThe capacity lever
$50/ 5K pack

An add-on that grants extra credits beyond the plan, sold two ways: a one-time pack billed at purchase, or a recurring pack that grants credits every cycle. Customers add capacity without renegotiating the plan.

01 Set up

Price the credit unit once. Every subscription inherits it.

Lovable sells AI-assisted product building as a monthly credit subscription. The unit, ai_credits, gets defined once in Chargebee's Product Catalog. Grant quantity, rollover policy, and validity window all live there. When a new subscription activates, those defaults are already set.

The worked example. Throughout this recipe, Acme AI Corp signs an annual Lovable Enterprise contract. Volume-based pricing is negotiated to 75,000 ai_credits / month for $30,000 / year. All figures are illustrative.
Configure credit grant
Lovable Enterprise · ai_credits
Active
Credit unit
AI Credits
Grant quantity
50,000
Grant frequency
Monthly
Rollover
Time-limited · 1 month
Allowed negative balance
No

The grant configuration is where Chargebee knows how many credits to issue, when, and what to do with the balance at cycle end. Set it once on the plan and every new subscription inherits it automatically.

Three things define the grant: the quantity issued, the frequency it issues on, and how the balance is treated at the edges of each cycle. Quantity and frequency are simple values. The two edge cases, unused credits and exhausted credits, are where the commercial model takes shape. Both are covered below.

A What if a customer doesn't use the credits they bought?

Leftover credits don’t have to disappear. The rollover policy on the grant decides how much of an unused balance carries into the next cycle. Four modes cover the common models.

Rollover modesSelect one
No rollover

Unused credits expire at the end of the cycle. A clean slate every period.

Capped rollover

Carry forward up to a set maximum, e.g. 25% of the grant. Anything above the cap expires.

Full rollover

Every unused credit carries forward with no cap. Best for enterprise commit models.

Time-limited

Credits carry forward but expire after a fixed window, here one cycle. Used in this recipe, mirroring Lovable.

B What if they run out or go over?

By default, usage stops the moment the balance hits zero. If a hard stop isn't what you want, the model branches two ways. Both are off unless you switch them on.

Past zeroOff by default
Overdraft balance

Let the balance go negative up to a limit you define, so usage keeps flowing into an overdraft buffer that is settled against the next grant or invoice.

Overage billing

Attach an overage rate to the plan. Once credits run out, further usage is metered and billed at the agreed per-unit price at cycle end.

02 Sell

Sell credits in whatever motion you already run. Self-serve or sales-led.

Customers can buy credits in whatever motion fits your GTM: self-serve through PLG checkout, or sales-led through a quote and subscription in Chargebee CPQ. Either way, the credit grant sits on the same plan, so the contract states exactly what the customer is buying. For accounts that negotiate higher volume, the default grant can be overridden on that quote or subscription without any custom code or manual workflows.

CPQ / Quotes
Q-2026-0482
Prepared for Acme AI Corp · Lovable Enterprise (Annual)
Signed
Signed Jul 1, 2026
Line items
ItemBillingAmount
Lovable Enterprise
75,000 ai_credits / month
Annual, from Jul 1
$30,000.00 / yr
Manage Credit GrantsNew
Grant quantity override (ai_credits / month)75,000
Plan default: 50,000. This override applies to this subscription only.
Start date
Jul 1, 2026
Initial charge
$30,000.00
Recurring
$30,000.00 / year
CreatedSarah Chen · Account Executive
In reviewMarcus Reid · VP Sales
Approved & sentJul 1, 2026

The grant override applies to this subscription only. The plan default of 50,000 credits is unchanged for all other customers.

03 Meter

Every action draws down the balance. Chargebee keeps the count.

Your product fires a usage event. Chargebee writes it as an immutable operation: a debit, a hold, a grant, or a rollover. Every entry has a unique ID and is never overwritten. Corrections happen via offsetting entries, not edits.

The same ledger your billing team uses for reconciliation is the one you surface to your customers as their own credit history.

Chargebee
LLovable Inc.lovable-prod
Subscriptions Acme AI Corp Ledger
Live
Acme AI CorpSUB-2026-AAC-001 · Lovable Enterprise
Active
OverviewLedgerInvoicesAlerts
60,000 ai_credits available
15,000 spent this cycle • 18,000 rolled from Jun
60,000 available
15,000 spent
OperationTypeCreditsBalanceTimestamp
op_4421
Debit
-1,20060,000Jul 14 14:32
op_4420
Debit
-80061,200Jul 14 11:17
op_4419
Hold
-1,50062,000Jul 13 16:44
roll_02
Rollover
+18,00093,000Jul 1 00:00
grant_07
Grant
+75,00075,000Jul 1 00:00
Operations are immutable and append-only. Every credit event is recorded with a unique ID, making the ledger suitable for customer-facing audit views.

Audit trail

Every grant, debit, hold, rollover, and expiry is recorded. The ledger never overwrites. Corrections happen via offsetting credits, not edits.

Hold and authorize

Reserve credits before a long-running job starts. Capture or release when the job finishes. No double-spend race conditions.

In-product usage dashboards

The same ledger data powers the credit history your customers see. Pull it via API and render it directly in your product UI.

Rollover visibility

Rolled credits appear as a distinct operation type, so customers can see exactly what carried forward from the previous cycle.

04 Alert

Tell the customer the balance is running low. Before it hits zero, not after.

Set a threshold on the credit unit. When any subscription crosses it, Chargebee fires credit_balance_low, giving you a precise moment to act. Route it to your product to soft-gate new jobs, to your sales team for an upsell conversation, or to both simultaneously. You catch it early. Your customer never hits a wall.

Chargebee
LLovable Inc.lovable-prod
Alerts ALT-2026-0091
Live
ai_credits · low balanceThreshold: 5,000 credits
Active
Alert rule • credit_balance_lowEnabled
Unit
ai_credits
Trigger
Balance falls below threshold
Threshold
5,000 credits
Applies to
All subscriptions on this unit
Fires event
credit_balance_low
Subscriptions monitored
1,204
Within limits
  • BrightPath
  • Fenix Labs
  • + 1,202 more
3
In alarm
  • Acme AI Corp
  • Stackrise
  • Cloudbase
credit_balance_low fired
In-product
Soft gate
Block new AI jobs. Show a top-up prompt inside your product UI.
Sales
Rep signal
Slack the account exec with customer name and remaining balance.
Email
Top-up CTA
Chargebee emails the billing contact with a buy-more-credits link.
05 Surface

Give customers a live, accurate view of every credit

Chargebee's credit API returns available balance, grant history, and ledger operations in real time. Pull it into your product and surface what your customer actually needs: credits left, credits rolled from last cycle, and when the next grant lands. Customers who can see where they stand don't dispute invoices.

Available balance
60,000
ai_credits • as of now
Consumed this cycle
15,000
of 75,000 granted on Jul 1
Rolled from Jun
18,000
carried forward at cycle start

What your customer sees inside your product

AI Credits · Lovable Enterprise
60,000 credits
80%
Available60,000 credits
Used this cycle15,000 credits
Rolled from last cycle18,000 credits
Cycle resetsAug 1, 2026
Monthly credit usage
Feb
Mar
Apr
May
Jun
Jul

Live balance, no polling

Available balance, grants, and ledger operations are all readable via API. Render them on every page load, with no background sync jobs needed.

Full credit history for customers

The same ledger that powers your billing team’s audit view can power your customer’s credit history page. Grants, rollovers, and debits, all in one feed.

Upsell surface built in

Low balance triggers the alert. Your product layer surfaces the buy-more CTA. The top-up checkout is Chargebee-hosted, with zero integration work.

You can give your customers this same drill-down inside your product by reading it back from Chargebee's credit APIs, with no separate metering pipeline to build.

06 Bill

The plan renews the balance.
Top-ups bill on purchase. One invoice.

At renewal, the plan charge is unchanged. Top-up packs, whether one-time or recurring, appear as their own line items. The next credit grant issues automatically on the new term. Chargebee handles all three without any intervention on your end.

Chargebee
LLovable Inc.lovable-prod
Billing Invoices INV-2026-0701
Live
INV-2026-0701Acme AI Corp · Jul 1, 2026
PaidExport PDF
Invoice
INV-2026-0701
Period
Jul 1, 2026 to Jun 30, 2027
Customer
Acme AI Corp
Status
Paid
DescriptionQtyRateAmount
Lovable EnterpriseJul 2026 to Jun 2027 • 75,000 ai_credits / month
1
$30,000.00
$30,000.00
Subtotal
$30,000.00
Tax
$0.00
Total due
$30,000.00
Credit consumption is tracked on the ledger, not billed per-use. The next grant of 75,000 ai_credits issues automatically on renewal.

At cycle end, unused credits are evaluated against the rollover policy. They carry forward for one cycle as a rollover operation, and any still unused after that window appear as an expiry operation on the ledger, visible to you and your customers.

Start building

Immediate revenue and deeper customer relationships.

Prepaid credits mean customers buy upfront and stay engaged with their balance. Chargebee runs the grants, rollovers, expirations, and ledger automatically so your team ships the product, not the billing infrastructure. Customers stay in your app. You capture revenue from every cycle.