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.
| TEST | LIVE | |
|---|---|---|
| Real money | No | Yes |
| Gateway credentials | Sandbox | Production |
| API key prefix | mp_test_* | mp_live_* |
| Data isolation | Compound DB unique key on (merchant_id, environment) | Same |
How the environment is decided
- If the request carries an
X-Api-Key, the prefix wins (mp_test_*→ TEST,mp_live_*→ LIVE). - Else, the optional
X-Environmentheader is used (dashboard requests). - 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
- Get a
mp_live_*key. - Configure your gateway in LIVE (Dashboard → Developers → Gateway Credentials → LIVE).
- Register a LIVE webhook endpoint.
- Set
MINNHA_API_KEYto yourmp_live_*key in production. - Smoke-test with a real card for 1 SAR. Refund immediately.