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

> Connect Stripe test mode and start plan or credit-pack Checkout.

Ledger currently accepts **Stripe test keys and sandbox catalogs only**. Connect your organization's `sk_test_` key in the dashboard's Stripe page. Configure Checkout success and cancel URLs for your application before starting payments.

For a paid monthly plan, create the customer with `POST /v1/customers`, then call `POST /v1/billing/attach` with `customerId` and `planId`. For a credit pack, send `customerId` and `addOnId` instead. Redirect the customer to the returned `checkoutUrl`.

For a plan, Checkout completion alone does not grant credits. Ledger creates the monthly allocation after it processes the paid Stripe invoice webhook. Credit-pack Checkout uses a one-time payment; Ledger creates that allocation after it receives a paid `checkout.session.completed` event.

To upgrade an active monthly plan, call `POST /v1/billing/upgrade` with a more expensive plan and a client-generated `Idempotency-Key`. If Ledger returns a `paymentUrl`, send the customer to Stripe's hosted invoice page. The new plan's credits apply after payment and Stripe confirmation.

See [Integrate Ledger](https://docs.integrateledger.com/quickstart.md) for request bodies and [Credits and usage](https://docs.integrateledger.com/credits.md) for enforcement behavior.


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