Skip to main content
Start with the action in your product that can burn a customer’s credits, budget, or usage allowance. Prove that one path before you migrate billing or enforce every feature. The first integration has one job:
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.generate for an LLM call
  • api.request for a billable API request
  • workflow.run for a multi-step job
  • export.create for a costly export
Write down the feature slug and event slug you want your app to use: 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:
  1. Create a plan, for example Pro.
  2. Add the feature that gates or meters the paid action.
  3. Configure the meter if the feature is usage-based.
  4. Publish the plan version.
The plan version is the commercial rule your customer is pinned to. Future pricing experiments can ship as new plan versions without silently moving existing customers.

3. Install the SDK

Keep the API key on your server. Do not expose it in browser code.

4. Create or map one customer

Use customers.signUp when Unprice should provision the customer, subscription, entitlements, billing periods, and wallet from the plan version.
If you already have customers in your app, store the returned Unprice customerId beside your own account ID.

5. Run the decision in shadow

Call access.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.
Use this first when you need confidence that the plan version, entitlement, usage, and wallet state match the product behavior you already trust.

6. Enforce when the decision is ready

When the usage amount is known at the decision point, use usage.consume before the paid work runs. It synchronously applies the usage event and returns the allow or deny decision.
Use the same 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:
This keeps the budget envelope separate from the workload executor: your app owns the workflow; Unprice owns the customer spend authorization and evidence.

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.