Appearance
Environments
Each country is its own deployment, with its own host, currency and keys. A checkout, charge or account exists only on the host that created it.
Hosts
| Country | Currency | Mobile money rail | Payments host (staging) |
|---|---|---|---|
| Kenya | KES | M-Pesa | https://payments-ke-staging.mookhpay.co |
| Uganda | UGX | MTN MoMo | https://payments-ug-staging.mookhpay.co |
Two prefixes on that host matter to you:
| Prefix | Who calls it | Auth |
|---|---|---|
/v1/payments/merchant | Your server | Your secret key. See API keys and scopes |
/v1/payments/public | The payer's browser: the hosted checkout page and the card element | None, or a charge's client_secret |
text
https://payments-ke-staging.mookhpay.co/v1/payments/merchant/checkoutsProduction hosts are not listed on this site. The paths are the same in production; only the host changes. Keep the host in configuration, not in code.
Country and currency
The country is the country of the deployment that issued your key. A Kenyan key works only on the Kenyan host, and everything it makes is in KES. A Ugandan key works only on the Ugandan host, in UGX.
There is no currency or country field on any request. Do not send one: unknown fields are refused with 400 and code 1701.
Ids carry the country: cs_ke_…, ch_ug_…, acct_ke_…. The hosted checkout page reads the prefix to call the right host.
A platform that serves both countries needs an organisation and a key in each.
Key prefix
| Prefix | Issued by |
|---|---|
mkp_test_ | Staging. Every key staging issues has this prefix |
mkp_live_ | Production. Every key production issues has this prefix |
The hub has no Test and Live switch for secret keys. The prefix follows the deployment. It does not grant anything by itself, but payments-service reads it in one place: a direct charge made with an mkp_test_ key is a test charge.
What is real on staging and what is a test
Staging moves real money
Staging calls the real M-Pesa and MTN MoMo rails. A hosted checkout for KES 1 made with a secret key prompts a real phone for KES 1, and the money lands in a real wallet.
On staging, with an mkp_test_ key | Real or test |
|---|---|
A hosted checkout (POST /checkouts) | Real. A secret key's checkouts are never test checkouts, on any deployment. Test with a small amount and your own phone |
A direct charge by mobile_money | Test. Paid only by the four test numbers. No prompt, nothing booked |
A direct charge by paybill | Refused: 400 and code 3004. Pay Bill is not offered in test mode |
A direct charge by card | Refused: 400 and code 3004. Card is never offered in test mode. See Testing |
A checkout from a Pay Button pk_test_ key | Test. Paid only by the test numbers |
| Platform accounts, balances, payouts, login links | Real. An account created on staging is a real MOOKHPay account, and a payout sends real money |
In production, an mkp_live_ key makes real checkouts and real charges, and a test number is refused with 422 and code 2838.
Switched on per deployment
Some route groups exist only where the deployment switches them on. Where a group is off, its routes are not registered and answer 404.
| Routes | Switched on by |
|---|---|
POST /checkouts, GET /checkouts/:id | Always on |
/charges | Direct charges on the deployment |
card as a charge method, and the card element routes | Direct charges and card charges on the deployment, with the card rail on for the country's currency |
/accounts, /transactions, business account requests | The platform API on the deployment |
| Payouts | The platform API and platform payouts |
| Login links | The platform API and login links |
| Account links | The platform API and account links |
Platform routes also need your organisation to be switched on as a platform by MOOKHPay. See How platforms work.