Guide

Going live

Test keys, live keys, and what changes when you flip the switch.

Every object carries livemode. Test and live are fully separate ledgers — test customers, cards, and payments never appear in live, and vice versa.

Keys

  • ak_test_… — sandbox. Use the numbers on Test cards; no money moves.
  • ak_live_… — production. Real cards, real settlement.

Keys are issued by your account manager. The key id travels in X-Key-Id; the secret signs every request (see Authentication).

Introspect the active key

GET/v1/me returns { merchantOrgId, keyId, entitlements } for the key you're signing with. Use it in CI to assert you're pointed at the right merchant. The mode (test vs. live) is not returned directly — infer it from the key prefix: ak_test_ keys are sandbox, ak_live_ keys are production.

Restricted keys

A key carries scopes (e.g. payments:read, payment_intents:create, payment_links:create). Issue a read-only key for reporting jobs and a write key for your checkout backend — a leaked reporting key can't move money.

Return-domain management needs return_domains:write granted explicitly. A legacy key issued without scopes can read the list but cannot change it. Grant domain-write permission only to the backend that manages your registered origins.

Existing checkout keys keep their current API access; they do not receive domain-write permission automatically. Keys cannot edit their own scopes. Scopes are set at issuance, and rotation preserves them. For automated registration, have an authorized dashboard user or CX Pay issue a separate key with return_domains:read and return_domains:write; your existing checkout key can stay in use. Include the required payment scopes too if the new key will also handle checkout. See Existing API keys.

Return and embed origins

Each MerchantOrg has separate test and live return-domain lists. Adding or removing a domain with a test key leaves the live list unchanged. Register each origin in live before creating live checkouts or embedding a live session from it. An empty list permits no external return or embed origins.

Both modes require public HTTPS domain names. Localhost, loopback and IP addresses are refused; use an HTTPS tunnel for local development. Removing a domain affects new checkout URLs and embed initialization; existing sessions keep their saved return URLs until expiry.

Go-live checklist

  • Swap ak_test_… → ak_live_… and use its matching secret. Both modes use https://api.cxpay.net; the key selects the mode.
  • Verify the live return-domain list includes every return, cancel and embedding origin you need.
  • Re-register webhook endpoints for live mode and confirm signature verification (X-CXPay-Signature).
  • Run one real transaction end to end, then refund it.
  • Confirm livemode: true on the resulting objects.

Test and live secrets are different. A valid ak_test_… key still creates test payments on production infrastructure. Assert livemode against your order's expected mode before fulfillment.

Powered by CX Pay