Concepts
The few pieces an integration needs.
| Resource | Meaning |
|---|---|
| Organization | Your team and its applications. |
| Application | A product with its own environments. |
| Environment | An isolated catalog, customers, API keys, and payment connection. |
| Catalog | The features and plans defined in orbyte.config.ts. |
| Deployment | An immutable snapshot of features, prices, and plans. |
| Customer | A stable identity from your application. |
| Grant | Credits a customer can spend on an explicit set of features. |
| Event | A tracked use of a feature with an idempotency key. |
orbyte.config.ts
orbyte.config.ts defines your application's billing catalog. Keep it alongside
your code. Import defineConfig from orbytelabs and default-export its result.
The catalog contains:
features: stable keys, usage tracking rules, and credit prices.plans: subscription prices, billing periods, credit grants, and feature access.
Publish it from the file's directory to your linked environment:
npx orbytelabs deployEach deployment publishes the complete catalog. Editing the file takes effect after a successful deployment. Your server sends feature keys when checking or tracking usage; the backend applies the deployed rules. Request handlers do not need to import the config.
Start with the quickstart config, then see catalog and pricing for the available rules.
Credits and money
One credit is 1,000,000,000 integer ledger units. SDK balances are bigint; JSON
encodes them as decimal strings. credits("0.01") is 10000000n.
USD amounts use nano dollars with the same scale. usd("9.99") is 9990000000n.
Subscription prices must be exact cents for Stripe.
A paid top-up costs $1 per credit. Catalog feature prices and subscription credit
grants are configured separately.
Access follows grants
A grant has one shared balance. By default, it can fund any deployed feature,
including features added later. Set featureKeys to limit the grant to specific
features. An empty list grants no feature access. Several grants can fund one
event, and even a free feature requires a positive eligible balance.
Subscription grants also require an active or trialing subscription within its access period. Manual and purchased grants work independently of subscriptions. The overall balance can differ from the amount available to a specific feature.
History is retained
A new ready deployment controls pricing for new events. Existing subscription grants retain their recorded plan terms. Retrying a recorded event uses its original definition. Ledger allocations identify the grants that paid for usage.
