Skip to content

Retrieve your balance ​

Reads your own account's balance: its main wallet and its own pockets, as the ledger has them now. Use it to reconcile your books with MOOKHPay, for example every night.

This is the balance of the account that owns the key. A platform's main balance is here: the customer payments it took and has not paid in yet. The pockets your platform opened in other people's wallets are not; read those with Retrieve an account's balance.

It reads only. Nothing on this route moves money.

Endpoint ​

GET /v1/payments/merchant/balance
AuthSecret key, Authorization: Bearer mkp_…
Scopebalance:read. Only an Owner can add it to a key, and no key has it unless an Owner chose it
PlatformNot needed. Any account's key can have balance:read: a business, a platform, or a person's own account
Switched onOn every host

Headers ​

HeaderRequiredValue
AuthorizationYesBearer mkp_test_… or Bearer mkp_live_…

There are no parameters.

Example request ​

sh
curl https://payments-ke-staging.mookhpay.co/v1/payments/merchant/balance \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

const res = await fetch(`${BASE}/balance`, {
  headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const answer = await res.json();
if (!answer.ok) throw new Error(`${res.status} ${answer.code}: ${answer.description}`);

const { currency, available, as_of } = answer.data;
console.log(`${currency} ${(available / 100).toFixed(2)} in main at ${as_of}`);

Response ​

200 OK with description Balance.

json
{
  "ok": true,
  "description": "Balance",
  "data": {
    "currency": "KES",
    "available": 48250000,
    "pockets": 1500000,
    "total": 49750000,
    "wallets": [
      { "wallet": "main", "name": "Main", "balance": 48250000 },
      { "wallet": "tax-reserve", "name": "Tax reserve", "balance": 1500000 }
    ],
    "as_of": "2026-11-25T21:00:00.412Z"
  }
}

Response fields ​

FieldTypeMeaning
currencystring or nullKES or UGX, from the host. null only on a deployment with no mobile-money rail switched on
availableintegerMinor units. Your main wallet's balance
pocketsintegerMinor units. Your own pockets added together. 0 when you have none
totalintegerMinor units. available plus pockets
walletsarrayOne entry per wallet you hold, main and your own pockets
wallets[].walletstringmain, or a pocket's slug. Pass it as wallet to List your balance transactions
wallets[].namestringThe wallet's name as you see it in MOOKHPay
wallets[].balanceintegerMinor units. The ledger keeps whole currency units, so this is always a multiple of 100
as_ofstringISO 8601. When MOOKHPay read the balance

There is no pending or reserved split: money reserved for a payout in flight has already left the balance.

Errors ​

HTTPCodeNameWhenWhat to do
4003014IDENTITY_HEADER_REFUSEDThe request carries a session or identity headerRemove the header
4012781API_KEY_INVALIDMissing, malformed, unknown or revoked keyCheck the key
4032941API_KEY_SCOPE_REQUIREDThe key lacks balance:readAn Owner issues a key with the scope
4033042API_KEY_IP_NOT_ALLOWEDThe account has allowed addresses and the call came from another addressCall from a listed address
4291804RATE_LIMIT_EXCEEDEDOver the rate limit belowWait Retry-After seconds
5032752LEDGER_UNAVAILABLEThe ledger did not answerRetry with backoff
5032782AUTHN_UNAVAILABLEKeys cannot be checkedRetry with backoff

Rate limit ​

120 requests a minute per account, or the higher number MOOKHPay set for it, shared with List your balance transactions. Over it: 429, code 1804, with Retry-After and data.retryAfter in seconds.

Staging documentation. A checkout made with a secret key on staging charges a real phone. See Environments.