Navigation

SaaS Metered Billing with Edge

Charge customers when usage crosses a metered threshold

Goal: Automatically charge SaaS customers when their API usage (or any metered resource) exceeds a defined limit. Edge handles the billing decision and payment while your platform handles usage tracking.

What You'll Need

Trigger Billing (Threshold mode, off_session) — Your platform passes the metric; Edge evaluates the condition
Billing Customers — Stores payment identity
Edge Webhooks — Notifies your system on charge success or failure

Steps

Create a metered usage item

Edge > Billable Items > New Item. Trigger type. Mode: Threshold, Capture: Charge Immediately, Condition: >=, Threshold: 10000, Price: $50.00. Description: 'When API calls >= 10,000, charge $50 overage'.

Onboard the customer

Create a billing customer with payment method and trigger permissions when they sign up for your SaaS.

Enroll in the metered item

Enroll the billing customer in the metered usage item.

Track usage

Your application tracks API calls per customer at regular intervals.

Fire with the metric

Call the fire endpoint with `metric_value`:

`POST /apis/edge/trigger/fire.php`
`{"billable_item_id": "bi_xxx", "billing_customer_id": "bc_xxx", "metric_value": 10247}`

Edge evaluates: 10,247 >= 10,000? Yes, charges $50. If below threshold, no charge.

Handle the result

Subscribe to `trigger.captured` and `trigger.failed`. On success, log the overage and optionally reset the counter.

Result

Your platform tracks usage, Edge handles billing decisions and payment. Pass the metric, Edge does the rest.

Variations

Tiered overage pricing

Multiple items at different thresholds: 10K = $50, 25K = $100, 50K = $200.

Per-unit pricing with Variable mode

Use Variable mode. Calculate total (excess calls x $0.001) and pass as override_amount.

Tip: Threshold mode is ideal when your platform tracks the metric but you want Edge to make the billing decision. If you calculate the charge yourself, use Fixed or Variable mode.

Was this article helpful?

NotebookLM Overviews