Usage-based billing recipes/Customer usage dashboard

Build a real-time customer usage dashboard with Chargebee

Your customers are on a usage-based plan. They deserve to see exactly what they’re consuming, in real time, inside your product, before the invoice arrives. This recipe shows you how to build that, end to end, with Chargebee’s Usage APIs.

Billing pattern
Metered usage
Complexity
Medium
APIs used
4
Reference
Zapier
Billing information > Usage
Live
Included pool used
820K of 750K
Overage started
Current overage
70K tasks
$0.02 / task
Upcoming invoice estimate
$1,400 projected
Usage over time
Last 30 days
Entitlements
This period
TasksMetered
820K
ActionsIncluded
Overage$1,400
Your account
Read-only
PlanZapier Team (annual)
Billing periodJun 1 → Jun 30
Overage rate$0.02 / task

Usage-based pricing creates a new obligation: real-time visibility for your customers.

AI agents, automation platforms, developer tools, the products that run on usage-based models today can burn through a monthly allocation in hours. The invoice is no longer a reasonable place to find out what something cost.

When a customer’s bill is tied to what they consume, the dashboard is part of the product contract. The questions it must answer aren’t optional:

What the dashboard needs to answer
  • “How much of my entitlement have I used, and how much is left?”
  • “Am I in overage, and what is it costing me right now?”
  • “Is my usage this month normal, or is something accelerating?”
  • “What will my next invoice actually look like?”
Working reference throughout this recipe: Northwind Labs on Zapier Team, 750K tasks/year, $0.02/task overage, currently at 820K. All figures are illustrative.
The recipe

Four APIs. Each answers one customer question.

Used together, they take a customer from “what did I buy?” to “what will I pay next?” in a single page load.

1
Retrieve SubscriptionBilling context
GET /subscriptions/{id} ↗

Your customer’s plan, billing period, quota, and which features are tracked for usage. Everything else on the dashboard is built on top of this.

2
Retrieve Subscription UsageCurrent usage
GET /subscription/{id}/usages ↗

How much they’ve used, how much was included in their plan, and what they’ve gone over, broken down per feature, updated in real time.

3
Retrieve Usage ReportHistorical trend
GET /subscription/{id}/usage_summaries ↗

Usage rolled up by day, week, or month. Answers whether this month is tracking above or below their usual pattern.

4
Upcoming Invoice EstimateInvoice preview
GET upcoming_invoices_estimate ↗

A live preview of the next invoice, every charge, including overages, before the billing cycle closes. Turns the dashboard from informational to financially useful.

01 Subscription context

What did they buy? Set the commercial frame first.

Before showing any usage number, the dashboard needs to know the plan, the quota, and which items are metered. One API call gives you all three.

What your customer sees
Northwind Labs
sub_Hs7pNorthwind  ·  Active
Active
Plan
Zapier Team
Billing cycle
Annual
Term start
Jun 1 2025
Term end / renewal
Jun 1 2026
Subscription items
zapier-team-annual
plan  ·  metered: false
$26,388/yr
Flat
tasks-overage-monthly
addon  ·  metered: true
$0.02/task
Metered
API call
GET /api/v2/subscriptions/{subscription_id}
// Response (abbreviated)
{
  "subscription": {
    "id": "sub_Hs7pNorthwind",
    "status": "active",
    "current_term_start": 1748736000,
    "current_term_end":   1780272000, // Jun 1 2026
    "next_billing_at":    1780272000,
    "subscription_items": [
      {
        "item_price_id": "zapier-team-annual",
        "item_type": "plan",
        "amount": 2638800,
        "metered": false   // flat ─ no usage card
      },
      {
        "item_price_id": "tasks-overage-monthly",
        "item_type": "addon",
        "metered": true    // ← render usage card
      }
    ]
  }
}
Fields used in dashboard
current_term_endnext_billing_atitem_price_idmetered: true→ determines which cards to show
02 Current usage

How much have they used? And how much is already in overage?

One call. Everything you need for usage cards, progress bars, and the overage alert, consumed, included, overage quantity, and overage amount.

Customer-facing dashboard
app.zapier.com/usage
DashboardZapsUsage & billingSettings
Usage & billing
Team plan  ·  Jun 1 2025 – Jun 1 2026
Tasks automated
tasks_automated
Overage
820K / 750K
Active Zaps
concurrent_workflows
Within limit
18 / 25
You’re in overage on tasks_automated
70K tasks above your 750K annual pool  ·  invoiced monthly at $0.02/task
$1,400
API call
GET /api/v2/subscription/{id}/usages
// Response (abbreviated)
{
  "usage": [{
    "subscription_id": "sub_Hs7pNorthwind",
    "feature_id":      "tasks_automated",
    "feature_name":    "Tasks Automated",
    "feature_unit":    "task",
    "consumed_quantity":  820000,
    "entitled_quantity":  750000,
    "overage_quantity":   70000,
    "overage_unit_price": 0.02,
    "overage_amount":     1400.00,
    "item_tiers": [...]
  }]
}
Fields used in dashboard
consumed_quantityentitled_quantityoverage_quantityoverage_unit_priceoverage_amount→ progress bar + alert card
03 Usage trend

How is usage changing? Context turns a number into a story.

820K tasks consumed is noise without history. Set window_size=month and you get monthly buckets, enough to see that usage spiked in September when a new integration went live, and has been accelerating since.

Usage trend chart
tasks_automated, monthly
window_size: month  ·  Jun 2025 – Dec 2025
Illustrative
Within pool
Overage
Jan–May projected →
0 250K 500K 750K pool Pool crossed · Nov Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar Apr May
MonthTasksvs poolOverageAmount
Jun–Oct 20251,320,000Within
Nov 2025780,000+30K30,000$600
Dec 2025820,000+70K70,000$1,400
API call
GET /api/v2/subscription/{id}/usage_summaries
// Query params
?window_size=month
&timeframe_start=2025-06-01
&timeframe_end=2025-12-31
&feature_id=tasks_automated

// Response — one row per window
{
  "usage_summaries": [
    {
      "feature_id":    "tasks_automated",
      "feature_unit":  "task",
      "consumed_quantity": 780000, // Nov
      "aggregated_from":   "2025-11-01",
      "aggregated_till":   "2025-11-30"
    },
    {
      "feature_id":    "tasks_automated",
      "consumed_quantity": 820000, // Dec
      "aggregated_from":   "2025-12-01",
      "aggregated_till":   "2025-12-31"
    }
    // ... one object per month
  ]
}
Fields used in dashboard
consumed_quantityaggregated_fromaggregated_tillwindow_size→ one bar per window in chart
window_size options
minutehourdayweekmonth
04 Invoice preview

What will they be charged? Show them before it posts.

Called with include_usages=true, the Upcoming Invoice Estimate returns a real-time invoice preview. The line_item_usages[] array links every charge back to the feature that caused it.

Invoice preview widget
Upcoming invoice estimate
Northwind Labs  ·  Dec 1–31 2025
Estimate, not yet posted
Zapier Team, annual plan
Recurring  ·  renews Jun 1 2026
1 × $26,388
tasks_automated: overage
70,000 tasks above 750K pool  ·  $0.02/task
consumed: 820,000entitled: 750,000overage: 70,000
70,000 × $0.02
$1,400.00
Estimated amount due  ·  Dec 31
Varies as usage accrues through period end
$1,400.00
API call
GET /api/v2/subscription/{id}/upcoming_invoices_estimate
// Query params
?include_usages=true
&invoicing_strategy=current_term_end

// Response (key fields)
{
  "invoice_estimate": {
    "line_items": [
      {
        "description": "Zapier Team - annual",
        "amount": 2638800
      },
      {
        "description": "tasks_automated overage",
        "amount": 140000,
        "metered": true
      }
    ],
    "line_item_usages": [{
      "feature_id":       "tasks_automated",
      "consumed_quantity": 820000,
      "entitled_quantity": 750000,
      "overage_quantity":  70000,
      "overage_amount":    1400.00
    }]
  }
}
Fields used in dashboard
line_items[].amountline_items[].descriptionline_item_usages[]overage_amount→ invoice preview card
Why Chargebee

Metering tracks what happened. Billing knows what it means.

Any metering system can count API calls. What it can’t tell you is whether those calls are within entitlement, which tier they fall into, what the overage rate is, and what the next invoice will say. That’s not a metering problem, it’s a billing problem. Chargebee sits at the intersection.

Entitlement-aware
consumed_quantity vs entitled_quantity is computed against your subscription’s commercial terms, not a raw counter. The entitlement boundary is the billing system’s job to know.
Invoice-accurate estimates
The upcoming invoice estimate uses the same calculation engine that generates real invoices. Tiers, overages, proration, billing cycles, the estimate is not an approximation. It’s a dry run of the actual invoice.
One source of truth
Dashboard and invoice are generated from the same Chargebee data. No reconciliation gap between what the dashboard showed and what the invoice charged. The number the customer saw is the number they pay.
Start building

Transparency turns customers into advocates.

When customers see exactly what they're consuming and paying for, trust goes up and disputes go down. Chargebee's Usage APIs surface real-time consumption, entitlements, and invoice previews so your dashboard shows the truth. Customers who see value stay. You build it once and it stays correct as plans change.