Build a product that charges prepaid credits per action
Use a credit balance for individually priced actions, with clear confirmation, transaction records, and defined retry behavior.
On this page
Prepaid credits fit products where a customer buys a balance and spends it on individual results. Connect your own paid action to the shared credit service.
How it works
Price a meaningful unit
Choose what counts as one paid operation, such as one export. Calculate costs on the server and explain the result before confirmation.
Define success and retry
Store a stable operation identifier and the result. Repeating that operation should return the same result instead of treating a retry as a new purchase.
Expose the record
Show the remaining balance and a ledger entry so customers can connect a delivered result to its credit cost.
Prepaid credits are different from monthly usage invoices
The starter accounts for a balance that customers spend. It does not aggregate metered usage and issue an invoice after the billing period. Choose that distinction deliberately when designing your offer.
For AI jobs, add a real task lifecycle
An external generation request cannot be rolled back by a database transaction. Add durable job state, provider retries, delivery tracking, and a compensation policy before charging for those jobs.
Limitations
- The shipped service does not include credit reservation, later settlement, partial refunds, or a job queue for external providers.
- A credit purchase still needs configured payment services. The isolated preview can demonstrate spending, but not checkout.
Questions
Is an AI generation service included?
A server-side model adapter is included. It makes stateless text requests, without a default chat UI, conversation storage or charging policy. Your product defines its conversations, tasks and credit usage.
What happens when the balance is insufficient?
The credit service rejects the consumption. Your product should give the customer a clear way to review their balance or purchase more credits when checkout is available.