Skip to main content
Usage-based billing lets you charge customers for what they actually use—API calls, storage, AI tokens, or any metric you define. Customers pay for consumption, not fixed fees.
Perfect for: APIs, AI services, infrastructure platforms, and any product where value scales with usage.

How It Works

1

Send Usage Events

Your application sends events when billable actions occur.
{
  "event_id": "evt_123",
  "customer_id": "cus_abc",
  "event_name": "api.call",
  "metadata": { "endpoint": "/v1/users" }
}
2

Meters Aggregate Usage

Meters aggregate events into billable quantities using Count, Sum, Max, or Last aggregation.
3

Automatic Billing

Set pricing per unit and free thresholds. Customers are billed automatically each cycle.

Core Concepts

Events

Events represent usage actions in your application. Each event includes:
  • Event Name: Type of usage (e.g., api.call)
  • Customer ID: Who used it
  • Metadata: Additional properties for aggregation

Meters

Meters aggregate events into billable quantities:
  • Count: Total events (API calls)
  • Sum: Add values (total bytes)
  • Max: Highest value (peak users)
  • Last: Most recent value
Create meter interface

Products with Usage Pricing

Set pricing per unit and optional free thresholds:
Pricing configuration
Example: 2,500 calls - 1,000 free = 1,500 × 0.02=0.02 = 30.00

Customer Credits

Give customers included usage credits that refresh each billing cycle. Credits apply before paid usage.

Quick Start

1

Create a Meter

In your dashboard: MetersCreate Meter
  1. Set event name (e.g., api.call)
  2. Choose aggregation (Count, Sum, Max, Last)
  3. Add optional filters
2

Add to Product

Link meter to a product with pricing:
Adding meter to product
  1. Select Usage-Based Billing
  2. Choose your meter
  3. Set price per unit and free threshold
3

Send Events

await fetch('https://test.dodopayments.com/events/ingest', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.DODO_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    events: [{
      event_id: "unique_event_id",
      customer_id: "cus_abc123",
      event_name: "api.call",
      metadata: { endpoint: "/v1/users" }
    }]
  })
});
4

Monitor Usage

Meter dashboard
Check your meter’s dashboard to see events and usage aggregation. Customers are billed automatically each cycle.

Use Cases

APIs & Infrastructure

Track API calls, compute hours, bandwidth, storage. Example: $0.001 per call after 10,000 free.

AI Usage Tracking

Track tokens, generations, processing time. Example: $0.04 per standard image, $0.08 per HD.

Data & Analytics

Bill by data processed, queries run, records analyzed. Example: $5 per GB after 10 GB free.

Communication

Count messages, minutes, data transferred. Example: $0.01 per SMS sent.

Next Steps

I