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
| Type | Description |
|---|
FIXED | A flat amount billed each billing period |
USAGE | A 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
| Field | Required | Description |
|---|
type | ✅ | FIXED or USAGE |
unit_price | ✅ | Price per unit (for USAGE) or flat amount (for FIXED) |
meter_id | Required for USAGE | The meter whose events are aggregated for billing |
display_name | | How 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 ACTIVE → INACTIVE.
How Usage Charges are Calculated
At invoice generation time, Fluxrate:
- Finds all
UsageEvent records for the linked meter within the billing period
- Applies the meter’s aggregation type (SUM, MAX, UNIQUE_COUNT, LAST)
- Multiplies the result by
unit_price
- 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.