> ## Documentation Index
> Fetch the complete documentation index at: https://docs.integrateledger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox and live environments

> Keep test billing separate from live customers and payments.

Ledger keeps sandbox and live catalogs, customers, usage, credit balances, API keys, Stripe connections, and Checkout return URLs separate within one workspace. Use **Sandbox** to build and test your integration. Select **Live** in the dashboard only when you are ready to configure production billing.

## How the API chooses an environment

The API key selects the environment. A `ledger_test_` key accesses sandbox data; a `ledger_live_` key accesses live data. Both use `https://api.integrateledger.com` and the same endpoint paths. Send the key from your backend in `Authorization: Bearer <key>`. A request cannot switch environments with a body field or HTTP header.

Keep different server-side variables for the two keys. Do not use a live key in local browser code, test jobs, or sandbox fixtures. Customer IDs may be the same in both environments, but each environment has its own customer record and balance.

## Prepare a live workspace

1. Complete the [sandbox billing walkthrough](https://docs.integrateledger.com/sandbox-test.md), including a plan, credit pack, and idempotent usage event.
2. Select **Live** in the dashboard and create its API key. Store it securely; Ledger shows it only once.
3. Create live features, plans, and credit packs. Sandbox catalog items are not copied into Live.
4. Connect your Stripe `sk_live_` key in **Developer → Stripe**. Ledger creates a separate live webhook endpoint. Confirm the connected account and webhook status before taking payments.
5. Set HTTPS success and cancel URLs in **Developer → Checkout**. These are independent of sandbox URLs.
6. Verify that paid live plans show **Synced**. Activate the live environment once the dashboard reports that its API key, Stripe connection, webhook, return URLs, and catalog sync are ready.

Activation confirms the workspace setup. It does not by itself enable real-money Checkout: Ledger also has a deployment-level live-charge gate, disabled by default. If the dashboard says live payments are gated, catalog and customer setup can continue, but paid Checkout and upgrades return `503 live_charges_disabled`. Do not send buyers a live Checkout link until the dashboard reports that live charges are enabled. Disabling new charges does not expire Checkout links already created; an operator must close outstanding sessions separately if sales need to stop immediately.

## Verify live billing

Use a low-value plan and a customer you control. Open the returned Stripe Checkout URL, complete a real payment, and confirm the Ledger customer shows an **Active** subscription and the expected credit balance after the signed live invoice webhook arrives. Test a credit-pack purchase separately, then call `POST /v1/check` and `POST /v1/track` with a unique `request_id`. A browser return URL is not proof of payment.

Live payments use real money. Make a deliberate choice about the test amount and refund or cancellation in your Stripe account before inviting customers.

See [Authentication](https://docs.integrateledger.com/authentication.md) for key handling and [Billing](https://docs.integrateledger.com/billing.md) for payment timing.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.