Skip to main content
A Charge is a price component attached to a plan. Plans can have multiple charges — for example, a base subscription fee plus per-unit charges for multiple usage meters.

Charge Types

TypeDescription
FIXEDA flat amount billed each billing period
USAGEA per-unit price, calculated from metered usage

Creating a Fixed Charge

curl -X POST https://api.fluxrate.co/api/v1/plans/<plan_id>/charges \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=<token>" \
  -d '{
    "type": "FIXED",
    "unit_price": 99.00,
    "display_name": "Pro monthly subscription"
  }'

Creating a Usage Charge

curl -X POST https://api.fluxrate.co/api/v1/plans/<plan_id>/charges \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=<token>" \
  -d '{
    "type": "USAGE",
    "meter_id": "<meter_id>",
    "unit_price": 0.005,
    "display_name": "Storage (per GB)"
  }'

Charge Fields

FieldRequiredDescription
typeFIXED or USAGE
unit_pricePrice per unit (for USAGE) or flat amount (for FIXED)
meter_idRequired for USAGEThe meter whose events are aggregated for billing
display_nameHow the charge appears on invoices

Managing Charges

View Plan Charges

GET /api/v1/plans/<plan_id>
The response includes a charges array with all active charges.

Deactivate a Charge

curl -X PATCH https://api.fluxrate.co/api/v1/plans/<plan_id>/charges/<charge_id> \
  -H "Content-Type: application/json" \
  -H "Cookie: access_token=<token>" \
  -d '{
    "status": "INACTIVE"
  }'
Charge deactivation is permanent. An inactive charge cannot be reactivated. Create a new charge to replace it.Status can only transition from ACTIVEINACTIVE.

How Usage Charges are Calculated

At invoice generation time, Fluxrate:
  1. Finds all UsageEvent records for the linked meter within the billing period
  2. Applies the meter’s aggregation type (SUM, MAX, UNIQUE_COUNT, LAST)
  3. Multiplies the result by unit_price
  4. Creates a line item on the invoice
Usage = aggregate(events in period, aggregation_type)
Line Item Total = Usage × unit_price

Multiple Charges on One Plan

Plans can have multiple charges of any type:
Enterprise Plan
├── Base Fee (FIXED) → $500/month
├── API Calls (USAGE) → $0.0005/call
├── Storage (USAGE) → $0.02/GB
└── Premium Support (FIXED) → $100/month
Each charge generates a separate line item on the invoice, giving customers full transparency into what they’re being billed for.