ledger CLI. Your backend talks to Ledger through the SDK.
1
Create a Sandbox API key
Sign in to the dashboard, check that the sidebar switch is on Sandbox, then open Settings › API keys and choose Create key. The key starts with Keep it on your server: it can spend any customer’s credits. API keys covers permissions.
ledger_test_ and is shown once.Put it in your server’s environment, for example in a gitignored .env:.env
2
Install the SDK and the CLI
The SDK runs in your backend. The CLI manages the catalog and needs Node 22.18 or later, or Bun, whatever your app is written in.
3
Define your catalog
npx integrateledger-cli init writes a starter config: ledger.config.ts in a JavaScript project, ledger.catalog.json anywhere else. Edit it to describe what you sell:0 makes it free. Catalog explains each item.4
Publish it to Sandbox
push syncs each paid plan to Stripe. Sandbox comes with a Stripe test account that Ledger creates for your workspace, so there’s nothing to set up in Stripe yet. From now on, change pricing the same way: edit the file, review the diff in a pull request, push. The CLI reference has every command.5
Create the customer on signup
Use your app’s own user or organization ID as the The customer now has 50 credits. Creating customers covers the details.
customerId, and attach the free plan when they sign up. Creating a customer grants nothing; attaching a plan does. A free plan starts at once, without Checkout.Other ways. You can build the catalog in the dashboard (Plans, Features, Add-ons) and bring it into your file with
npx integrateledger-cli pull, or call the API directly. Keep one source of truth: ledger push archives anything that isn’t in the file.Next steps
Gate features
Check the balance before an action and track it after.
Display billing
Show the balance and sell plans with Stripe Checkout.