Usage-based billing on a single Cloudflare stack

Usage drips in. It lands on a tab. The period closes — and settles.

Record events, generate invoices, collect payments — without running a separate database. Cloudflare Workers + D1 + Durable Objects.

dtab sync driptab.yaml — plans, metrics, and catalog upserted in one shot.
drip · meteringtab · accrualperiod close · invoicedriptab.app
The billing loop

Four moves. Each one idempotent.

Drip in, accrue, close, settle. The same loop for usage-based and flat-fee — on the same plan.

01 / Ingest

Events drip in

Your backend sends usage events with a transaction ID. Driptab deduplicates and aggregates in real time via Durable Objects.

02 / Accrue

They land on the tab

The SubscriptionMeter keeps a running tally per subscription, per metric. Counters are durable — survive worker restarts.

03 / Close

The period closes

An alarm fires at period_end. Counters roll up into fee line items; an invoice is written to D1 atomically.

04 / Settle

And settles

Pricing is snapshotted into every fee row. A webhook fires. You collect payment. The tab is clean.

In context

The brand, alive

driptab
New meter
Events this period
1,284,930
across 312 subscriptions
Accrued · open tab
$4,072.18
settles in 6 days
Meter status
● serialized
dedup by transaction_id
api_calls · 982,400 × $0.0020$1,964.80
storage_gb · 1,140 × $0.150$171.00
egress_gb · 9,373 × $0.210$1,968.33
Invoice · period close$4,104.13
What you get

Everything billing needs. Nothing it doesn't.

// metered

Usage-based and flat-fee

Mix standard (per-unit) and flat-fee charges on the same plan. Both models in one billing cycle.

// idempotent

Safe to retry

Every event carries a transaction_id. Every API mutation is idempotent. Retry freely — no double-billing.

// catalog

Catalog-driven pricing

Define prices once in driptab.yaml. Plans reference catalog items — update a price, all future invoices pick it up.

// gitops

driptab.yaml sync

Commit your billing config. dtab sync upserts plans, metrics, and catalog atomically with a single command.

// audit

Full audit trail

billing_events logs every mutation. audit_logs records every API request. Immutable, queryable via the API.

// mcp

Agent-ready API

Readonly tokens let AI agents query billing state over MCP. Write tokens are separate — safe by default.

Pricing

Start free. Scale on events, invoices, and customers.

Core billing correctness is never an upsell. Higher tiers raise operating limits, retention, exports, and support.

Full plan limits

Open Source

Self-host on your Cloudflare account

Free
  • Worker + D1 + Durable Objects
  • REST API and dtab CLI
  • No hosted SLA
Read docs

Free

For evaluation and small projects

$0/month
  • 25k events / month
  • 50 active customers
  • 100 invoices / month
Start free

Starter

For first production billing

$49/month
  • 1M events / month
  • 1k active customers
  • 2.5k invoices / month
Start Starter

Pro

For growing SaaS teams

Popular
$299/month
  • 25M events / month
  • 10k active customers
  • 180-day audit retention
Start Pro

Scale

For usage-heavy products

$1,499/month
  • 250M events / month
  • 100k active customers
  • Scheduled exports
Talk to us

Enterprise

For dedicated, BYOC, or regulated use

Custom
  • Custom limits
  • SSO/SAML and SLA
  • BYOC or dedicated deployment
Contact sales
GitOps billing

Your billing config lives in git.

driptab.yaml
organization: acme
workspace: default
project:   billing

catalog:
  - code: vps.cx11
    name: "VPS CX11"
    amount_cents: 499
    currency: USD

metrics:
  - code: api_calls
    name: "API Calls"
    aggregation_type: count

plans:
  - code: pro-monthly
    name: "Pro Monthly"
    interval: monthly
    amount_cents: 2900
    currency: USD
terminal
# Install CLI
npm install -g @dotlabshq/dtab

# Authenticate
dtab token set dtab_f36951fb...

# Set context
dtab use acme/default/billing

# Push billing config
dtab sync driptab.yaml
✓ catalog  1 upserted
✓ metrics  1 upserted
✓ plans    1 upserted

# Analytics
dtab analytics
active_subscriptions  312
mrr_cents             906_800
revenue_30d_cents     4_072_18