Environments (TEST / LIVE)

minnha provides two fully isolated environments — TEST and LIVE. They share absolutely nothing: no transactions, no customers, no gateway credentials, no webhook endpoints, no API call logs.

 TESTLIVE
Real moneyNoYes
Gateway credentialsSandboxProduction
API key prefixmp_test_*mp_live_*
Data isolationCompound DB unique key on (merchant_id, environment)Same

How the environment is decided

  1. If the request carries an X-Api-Key, the prefix wins (mp_test_* → TEST, mp_live_* → LIVE).
  2. Else, the optional X-Environment header is used (dashboard requests).
  3. Else, the request defaults to TEST.
The SDKs accept an environment option to switch on the fly: await minnha.transactions.list({}, { environment: "LIVE" }). It's purely a hint — the server still enforces it from the key.

Dashboard switcher

The merchant dashboard has a TEST/LIVE switcher in the sidebar. Switching to LIVE requires explicit confirmation and displays a red banner so you can't mistake which data you're looking at.

Going live

  1. Get a mp_live_* key.
  2. Configure your gateway in LIVE (Dashboard → Developers → Gateway Credentials → LIVE).
  3. Register a LIVE webhook endpoint.
  4. Set MINNHA_API_KEY to your mp_live_* key in production.
  5. Smoke-test with a real card for 1 SAR. Refund immediately.