Skip to main content
Fluxrate is built around a small set of composable primitives. Understanding how they relate to each other will help you design the right billing model for your product.

The Data Model


Meters

A Meter is the lowest-level primitive. It defines:
  • What to measure (e.g., API calls, storage bytes, active users)
  • How to aggregate raw events (SUM, MAX, UNIQUE_COUNT, LAST)
  • Which property of the event payload to read
Every time your backend sends a usage event, it references a meter by its unique meter_token.
Aggregation TypeDescriptionUse Case
SUMAdds all values in the periodAPI calls, data transferred
MAXTakes the highest value seenPeak concurrent seats
UNIQUE_COUNTCounts distinct property valuesMonthly active users
LASTTakes the most recent valueCurrent storage used

Features

A Feature is an entitlement that wraps a meter (or not) and can be attached to plans. Features define what a plan unlocks for a customer.

Feature Types

Meter Feature

Tracks quantitative usage. Backed by a meter. Can have usage limits and reset periods.

Switch Feature

A boolean on/off flag. Use for capabilities that are simply enabled or disabled.

Custom Feature

A text or numeric entitlement value. Use for custom limits like “max 5 workspaces”.
When you create a Meter Feature, Fluxrate automatically creates the underlying meter for you.

Plans

A Plan is a billing product. It defines the pricing structure a customer subscribes to. Plans have:
  • A type: FIXED, USAGE, or HYBRID
  • A billing interval: day, week, month, or year
  • A currency
  • Features — what capabilities are included
  • Charges — how much to bill (fixed fees and/or usage-based prices)

Plan Types

TypeWhat It Means
FIXEDCustomer pays a flat amount every billing period
USAGECustomer pays based entirely on metered consumption
HYBRIDCustomer pays a base fee + additional usage charges

Charges

A Charge (also called a Price) is attached to a plan and defines the actual billing amount.
  • Fixed charge: A flat amount billed each period (e.g., $99/month)
  • Usage charge: A per-unit price linked to a meter (e.g., $0.001 per API call)
  • Tiered pricing: Different per-unit prices at different volume levels

Customers

A Customer represents one of your end users or accounts. Each customer has:
  • A unique external_id that matches your own system’s identifier
  • Billing address (important for tax calculation)
  • Associated subscriptions and invoices

Subscriptions

A Subscription links a customer to a plan. It represents the ongoing billing relationship.

Subscription States

TRIAL → ACTIVE → PAST_DUE → CANCELED
              → PAUSED
StatusDescription
TRIALCustomer is in a free trial period
ACTIVENormal billing is occurring
PAST_DUEInvoice payment overdue
PAUSEDSubscription temporarily halted
CANCELEDSubscription ended
Each subscription tracks current_period_start and current_period_end — the active billing window.

Usage Events

A Usage Event is a raw measurement sent from your backend. Each event records:
  • Which meter it belongs to (meter_token)
  • Which customer performed the action (customer_external_id)
  • A quantity (or property value, depending on aggregation type)
  • An optional timestamp and idempotency key
Events are stored and aggregated at invoice generation time.

Invoices

An Invoice is generated automatically at the end of each billing period. The lifecycle:
  1. DRAFT — Created by the background worker, not yet sent (1-hour review window)
  2. OPEN — Finalized and emailed to the customer
  3. PAID — Payment received
  4. VOID — Cancelled permanently
  5. UNCOLLECTIBLE — Written off as bad debt

Putting It Together

A typical Fluxrate implementation looks like:
  1. Create a meterapi_calls (SUM aggregation)
  2. Create a feature → Meter feature wrapping api_calls
  3. Create a plan → “Pro” plan at 49/month+49/month + 0.001 per API call
  4. Create a customercustomer_external_id: "user_123"
  5. Subscribe → Customer to the “Pro” plan
  6. Track usage → POST events as customer uses your API
  7. Invoice → Auto-generated at month end with exact usage billed

Next: Quickstart →

Follow the step-by-step guide to get your first integration running.