Usage-based billing works only when a customer can connect a charge to an understandable unit of value. “AI credits” without a definition make budgeting difficult and disputes expensive. Before choosing a billing provider, decide which product event is billable, when it becomes final and how a correction reaches the customer.
Define the unit before building the meter
Provider tokens, completed documents and successful workflow runs are different units. Your internal cost may be token-based while your customer-facing unit is a completed task. Write a contract for that unit: what qualifies, what is excluded, how retries behave and which pricing version applies. A failed model call should not silently count as a completed customer outcome.
The right unit depends on what customers buy and can verify. If task complexity varies substantially, a flat per-task price may expose you to unpredictable costs. Conversely, passing every provider detail through to a buyer can make the product difficult to budget. Model both the customer explanation and your delivery cost before choosing.
Keep a product usage ledger
In a hypothetical document-review product, one accepted review produces a stable usage event. Retries reuse that identity. The ledger records the workspace, unit, quantity, occurrence time, completion state and pricing version. Store enough provenance to investigate a charge without copying sensitive document contents into billing logs.
| Stage | Record | Question it answers |
|---|---|---|
| Product outcome | Review R-104 completed | Did the agreed billable task happen? |
| Usage event | Event U-104, quantity 1 | Was it counted once? |
| Rating | Pricing version P-3 | Which commercial rule applied? |
| Billing export | Provider acknowledgement | Was accepted usage delivered? |
| Reconciliation | Invoice period and adjustment | Does the charge match the ledger? |
This is an architecture example, not a claim about an existing AptixLabs billing deployment. Keep usage identity distinct from delivery-attempt identity: a failed network request can require a retry without creating a second billable task. Decide how late events, cancellations and corrections affect closed periods.
Choose the billing integration against current requirements
Stripe's current documentation distinguishes basic meter-event ingestion from its broader Metronome offering. Product names and recommended paths can change, so review the current integration documentation during scoping. Requirements such as contract pricing, credits, corrections and customer-visible usage should guide the choice rather than an old tutorial's endpoint.
Reference: Stripe's current usage-recording documentation
Test the invoice, not just the webhook
Replay a duplicate event, deliver an event late, interrupt the export and correct a previously counted task. Then compare the ledger, the provider's accepted usage and a test invoice. Define who investigates mismatches and how the customer sees an adjustment. These tests complement webhook idempotency; they do not replace it.
Related: idempotent subscription webhook processing
Budget notifications and hard spending limits also need separate definitions. A notification can arrive after additional usage; it is not automatically a spending cap. If you promise a cap, enforce it where work is admitted and decide how concurrent jobs reserve or release allowance.
Bring a charge example to discovery
For a SaaS billing engagement, show one sample customer action, the proposed charge and the expensive failure case. AptixLabs can help map that path into an event contract, integration scope and reconciliation checklist. A clear explanation of one charge is a better starting point than implementing a flexible meter with no agreed commercial meaning.
Should an AI SaaS product charge per token or per completed task?
Choose a unit buyers can understand and your system can verify, then model its delivery cost. Tokens and completed tasks have different budgeting and margin trade-offs; neither is universally correct.
How do we avoid duplicate usage charges?
Give each billable product event a stable identity, make delivery retries idempotent and reconcile accepted provider usage against the product ledger and invoice. Test corrections and late events too.
