Decide whether one paid action should run, then keep the evidence that explains what happened.
1. Pick the paid action
Choose a narrow action with a clear customer and feature:ai.generatefor an LLM callapi.requestfor a billable API requestworkflow.runfor a multi-step jobexport.createfor a costly export
Use the event slug for the broad thing your app observed. Use feature slugs for the specific
product features that read from that event.
2. Publish a plan version
In the dashboard:- Create a plan, for example
Pro. - Add the feature that gates or meters the paid action.
- Configure the meter if the feature is usage-based.
- Publish the plan version.
3. Install the SDK
4. Create or map one customer
Usecustomers.signUp when Unprice should provision the customer, subscription, entitlements,
billing periods, and wallet from the plan version.
customerId beside your own
account ID.
5. Run the decision in shadow
Callaccess.check beside your current logic before the paid action runs. It is read-only, so it is
safe to log and compare before you let Unprice enforce anything.
6. Enforce when the decision is ready
When the usage amount is known at the decision point, useusage.consume before the paid work runs.
It synchronously applies the usage event and returns the allow or deny decision.
idempotencyKey when retrying the same request.
7. Use a budgeted run for multi-step work
If the action can spend across multiple steps, reserve a budget before the work starts, report the usage created inside the workload, then close the run so unused reserved funds are released:Next steps
Choose the runtime call
Compare
access.check, usage.record, usage.consume, and budgeted runs.TypeScript SDK
Learn the SDK result shape, retries, base URL, and telemetry options.