ZapAPI Docs
Get StartedConceptsAI GatewayGuidesPayment GatewaySDKAPI ReferenceResources
Concepts

Environments

Live vs test mode in ZapAPI — how to use the zap_test_ sandbox for development, CI and end-to-end tests.

ZapAPI has two environments — live and test — selected entirely by the API key you use. There is no separate "sandbox account" and no separate base URL.

LiveTest
Key prefixzap_live_zap_test_
SatsReal mainnet satsTest/regtest sats, no real value
InvoicesSettle on mainnetSettle instantly in test
Webhookslivemode: truelivemode: false
Rate limitsHigherLower

Test mode is a real sandbox

Test mode is not a mock — it exercises the full ZapAPI pipeline:

  • Invoice creation, expiry, cancellation and QR codes.
  • Webhook signing, delivery, retries and replay.
  • Payment links, refunds, customers, and the CRM.
  • Rate limits and idempotency semantics.

The only difference is settlement: test invoices settle instantly against a test Lightning network, and webhook events are flagged livemode: false.

Using test mode in the SDK

const zap = new ZapAPI(process.env.ZAPAPI_TEST_KEY); // zap_test_…
zap.isTestMode; // true

const invoice = await zap.invoices.create({
  amount: 1000,
  currency: 'sat',
  description: 'Test payment',
});

Webhooks in test mode

Webhook events delivered to a test-mode endpoint carry livemode: false. Always branch on this flag in your handler so you never fulfill a real order from a test event:

if (event.livemode === false) {
  // test event — log it, but don't fulfill a real order
  return res.json({ received: true });
}

CI and end-to-end tests

Test mode is designed for CI:

  • Provision a dedicated test project and test API key in your CI secrets.
  • Run your integration tests against the live API with the test key — no mocks, no stubs, full confidence.
  • Use the webhook test endpoint to deliver a synthetic test event through the real pipeline.

Promoting to production

When you are ready to go live:

  1. Create a live API key (zap_live_…) with the same scopes as your test key.
  2. Deploy it to production via your secrets manager.
  3. Subscribe a live webhook endpoint (the dashboard distinguishes test and live endpoints).
  4. Process a small real payment to verify the end-to-end flow.

Your code does not change between test and live — only the key. The base URL, endpoints, request/response shapes and webhook semantics are identical.

On this page