> ## 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.

# Production checklist

> Go from Sandbox to taking real money in four dashboard steps and a key swap, with a checklist of everything worth verifying first.

Going live takes four steps in the dashboard and a key swap in your backend, with no review to wait for: live charges start as soon as you finish. Live has its own keys, catalog, customers and Stripe account, so Sandbox stays exactly as you left it. Work through this list in order.

## Before you start

* [ ] Your integration works end to end in Sandbox, including a Checkout paid with a [test card](https://docs.integrateledger.com/billing/checkout-and-attach.md).
* [ ] You've tested the [scenarios below](#scenarios-worth-testing) with simulated time.
* [ ] Your Stripe account is activated for live payments.
* [ ] Your app has `https` pages for Checkout to return to.

## 1. Connect your live Stripe account

Open the **Sandbox** menu at the top of the sidebar and choose **Go to production**, or open the last step of **Get started**. Each step acts on Live while the dashboard stays in Sandbox.

* [ ] **Connect Stripe.** Choose **Connect Stripe**, sign in to Stripe and pick the account your customers will pay into. Ledger never holds your key, and Stripe delivers that account's events to Ledger.
* [ ] **Or paste a key.** Choose **Use a secret key instead** and paste a live secret key (`sk_live_…`) from [Stripe's API keys page](https://dashboard.stripe.com/apikeys). Ledger checks the key with Stripe, encrypts it, and creates a signed webhook endpoint in your account. If Stripe refuses the key, the step says so; create a new one and paste it.
* [ ] **The Stripe webhook is receiving.** The step is done once Stripe can deliver to Ledger; choose **Check again** to recheck. Ledger grants nothing a payment hasn't confirmed through this webhook. [Stripe](https://docs.integrateledger.com/stripe.md) lists the events.

## 2. Put your catalog in Live

* [ ] **Copy plans.** Choose **Copy plans**. Ledger lists what it will add, update and archive in Live, then publishes your Sandbox plans, features and credit packs to Live with every field (billing intervals, seat prices, tiers and overage terms included) and syncs each paid plan to your live Stripe account. Anything in Live that isn't in Sandbox is archived.
* [ ] **Every paid plan is synced.** The step is done once Live has something to sell, a paid plan or a credit pack, and every paid plan is synced. Credit packs are priced at Checkout, so they need no sync.

To publish Live from your catalog file instead, for example from CI after a merge, push with a Live key:

```yaml theme={"system"}
- run: npx integrateledger-cli push --live --yes
  env:
    LEDGER_API_KEY: ${{ secrets.LEDGER_LIVE_API_KEY }}
```

## 3. Create a Live key and go to production

* [ ] **Create a production key.** Choose **Create key**. The key starts with `ledger_live_`, has every permission, and is shown once: put it in your secret manager. Once Live is on, you can create keys with fewer permissions in **Settings › API keys** ([API keys](https://docs.integrateledger.com/api-keys.md)).
* [ ] **Go to production.** Choose **Go to production**. Ledger checks each step again and Live appears in the dashboard.

## 4. Finish in Live

With the dashboard on Live:

* [ ] **Checkout redirects.** In **Settings › Checkout**, set your production app's `https` success and cancel URLs. Paid `attach` calls return there, unless a call sends its own `successUrl`.
* [ ] **Tax.** You're responsible for sales tax, VAT and GST. To have Stripe calculate and collect it, set up Stripe Tax in your live Stripe account, then turn on **Automatic tax** in **Settings › Tax**. See [Tax](https://docs.integrateledger.com/billing/tax.md).
* [ ] **Ledger webhook endpoint.** If your app reacts to billing changes, add a Live endpoint in **Settings › Webhooks** and store its signing secret. Live events go to Live endpoints. See [Webhooks](https://docs.integrateledger.com/webhooks.md).
* [ ] **Swap the key.** Point your production backend at the `ledger_live_` key. Nothing else in your integration changes.

## 5. Check your backend

* [ ] **Refusals are handled.** Every `check` that answers `allowed: false` shows the customer something useful, by `reason`: `no_plan`, `feature_not_in_plan`, `limit_reached`, `insufficient_credits`, `overage_cap_reached`. Every `track` handles the same codes as a `409`, and `request_id_conflict`. [Check and track](https://docs.integrateledger.com/customers/check-and-track.md) has the list.
* [ ] **Each track has a stable `request_id`.** It comes from the action itself (a message ID, a job ID), so a retry can't charge twice.
* [ ] **Fail open is what you want.** The SDKs allow `check` and queue `track` when Ledger can't answer. Keep that for cheap actions; reserve before expensive ones, or turn it off with `failOpen: false`. See [Fail open](https://docs.integrateledger.com/fail-open.md).
* [ ] **The key stays on your server.** No browser or mobile app calls Ledger.

## 6. Take a real payment

* [ ] Buy your cheapest plan or pack with a real card.
* [ ] Check that the plan and its balances arrive on the customer.
* [ ] Refund it in Stripe. A refunded pack's unused credits expire; a refunded subscription keeps its credits; a fully refunded [lifetime plan](https://docs.integrateledger.com/pricing/lifetime.md) ends.

Live runs everything Sandbox does, with real time in place of [simulated time](https://docs.integrateledger.com/test/simulate-time.md). [Coupons](https://docs.integrateledger.com/billing/renewals-and-lifecycle.md#coupons) work in both; [Sandbox](https://docs.integrateledger.com/test/sandbox.md) lists every difference.

## Scenarios worth testing

In Sandbox, [simulate time](https://docs.integrateledger.com/test/simulate-time.md) to run each of these before you go live:

| Scenario | How |
| - | - |
| A renewal | Attach a paid plan, then advance past `currentPeriodEnd`. The new allowance arrives and the old one expires. |
| Overage on the invoice | On a plan with [overage](https://docs.integrateledger.com/pricing/overage.md), track past the allowance, then advance past the renewal. The invoice carries an overage line. |
| Cancellation | [Stop renewal](https://docs.integrateledger.com/billing/upgrades-and-downgrades.md), then advance past the period end. The subscription ends and its credits expire. |
| An upgrade mid-period | Advance two weeks, then [upgrade](https://docs.integrateledger.com/billing/upgrades-and-downgrades.md). The new plan starts a new period from the simulated time. |

## Turn off Live

To stop taking new payments, choose **Turn off Live** in **Settings › Workspace**. New Checkouts and upgrades are refused, and so is a downgrade that bills overage now (`overageOnPlanChange: "bill_now"` with overage to bill), each with `503 live_charges_disabled`. Other downgrades and cancellations go through, and existing subscriptions keep renewing in Stripe. Ledger can also suspend a workspace that breaks its terms; email [support@integrateledger.com](mailto:support@integrateledger.com) to resolve it.

## Troubleshooting

| You see | Why | Fix |
| - | - | - |
| `503 live_charges_disabled` | You haven't gone to production, Live was turned off, or the workspace is suspended | Finish **Go to production**. If suspended, contact support. |
| `401 unauthorized` | A Sandbox key | Use a `ledger_live_` key. |
| `403 insufficient_permissions` | A Live key without the endpoint's permission | Use a key with the permission named in `requiredScope`. |
| `400 checkout_urls_not_configured` | Live has no Checkout redirects | Set them in **Settings › Checkout** while viewing Live, or send `successUrl` with each attach. |
| `502 stripe_webhook_unhealthy` | The endpoint Ledger created was deleted or disabled in Stripe | Choose **Check again** in **Settings › Stripe**, or reconnect. |
| `502 stripe_not_configured` | Stripe rejected the key, or it lacks a permission | Connect again, with a full `sk_live_` secret key if you paste one. |

An agent can read where setup stands with [`GET /v1/setup`](https://docs.integrateledger.com/api-reference/setup/status).

## Rules

* Live goes to production once it has a paid plan or a credit pack to sell. Add one in Sandbox and copy plans again.
* Checkout success and cancel URLs in Live use `https` and a public host, not `localhost`.
* Until Live has Checkout redirects, a paid `attach` without its own `successUrl` returns `400 checkout_urls_not_configured`.
* Stripe deletes a test clock 30 days after it's created.


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