Testing Lightning in sandbox
Sandbox simulates the Lightning Network. Create invoices, receive payments and send payments with the same API calls you use in live, and get the same balance changes and webhooks. No real bitcoin moves.
How it works
Sandbox invoices are real, signed testnet BOLT11 invoices (they start with lntb). They decode in any Lightning library and work in QR codes.
Nothing pays a sandbox invoice on its own. You trigger the payment in one of three ways, below.
When an invoice is paid, your sandbox balance is credited and you receive the usual payment webhook, usually within 2 seconds.
Receive a payment
Create an invoice, then pay it using any of these:
Simulate a payment. Call the simulate endpoint on one of your open invoices.
Auto-settle. Create the invoice with "auto_settle": true and it is paid about 5 seconds later.
Pay it from another sandbox account. A second sandbox business pays your lntb invoice with the normal pay endpoint.
Create an invoice
Use Case
Create the invoice with "auto_settle": true and it is paid about 5 seconds later.
auto_settle is rejected in live.
Request Body
The invoice amount in satoshis.
What the payment is for. Shown in the payer's wallet.
A unique idempotency key for this request.
Sandbox only. Set to true and the invoice is paid about 5 seconds after it is created. Rejected in live.
Response Body (201)
The invoice ID. Use it to retrieve the invoice or simulate a payment.
Hash that identifies this payment on the Lightning Network.
The testnet BOLT11 invoice string. Starts with lntb.
The invoice amount in satoshis.
The description attached to the invoice.
pending when created. Moves to paid about 5 seconds later.
ISO 8601 timestamp when the invoice expires.
ISO 8601 timestamp when the invoice was created.
Simulate a payment
Use Case
The invoice must belong to your business, be unpaid and not expired. An invoice that is already paid or expired returns a 4xx error.
Response Body (200)
Whether the simulated payment was accepted.
Human-readable status message describing the result.
The ID of the invoice being paid.
The payment hash of the invoice being paid.
Send a payment
Use Case
Pay any lntb invoice with the normal pay endpoint.
Request Body
The lntb invoice to pay.
A unique idempotency key for this request.
Good to know
Sandbox can only pay testnet (lntb) invoices. Paying a mainnet lnbc invoice returns an error.
The normal balance check still applies: paying more than your sandbox balance returns an insufficient-balance error.
Each invoice can be paid once. A second payment returns "invoice is already paid".
Expired invoices cannot be paid or simulated.
Lightning addresses work the same way: invoices they create can be settled with any of the three methods.
Dashboard users can call POST /dashboard/lightning/invoices/{id}/simulate-payment.