Skip to content

List payouts ​

Lists the payouts your platform made from one account, newest first. It does not include payouts the seller made themselves, another platform's payouts, or payouts refused when you created them.

Endpoint ​

GET /v1/payments/merchant/accounts/{id}/payouts
AuthSecret key
Scopepayouts:write or accounts:read (either one)
PlatformYour organisation must be switched on as a platform, and the call must come from an allowed address if MOOKHPay set a list
Switched onPer deployment (PLATFORM_PAYOUTS_ENABLED). Where it is off, the route answers 404

Headers ​

HeaderRequiredValue
AuthorizationYesBearer mkp_…

Parameters ​

Path

NameTypeRequiredConstraints
idstringYesOne of your account ids

Query. Unknown parameters are refused.

NameTypeRequiredConstraints
limitintegerNo1 to 100. Default 20
starting_afterstringNoThe last payout_id of the previous page. Must be a payout of this account made by your platform

To page through every payout, pass the last payout_id of each page as starting_after until has_more is false. Payouts made while you page appear at the top and are not in the pages that follow. See Pagination.

Example request ​

sh
curl "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/accounts/acct_ke_9c2f41b07e5d38a6c1f0b294/payouts?limit=50" \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

export async function allPayouts(accountId) {
  const payouts = [];
  let after;
  for (;;) {
    const query = new URLSearchParams({ limit: "100" });
    if (after) query.set("starting_after", after);
    const res = await fetch(`${BASE}/accounts/${accountId}/payouts?${query}`, {
      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}`);
    payouts.push(...answer.data.payouts);
    if (!answer.data.has_more) return payouts;
    after = answer.data.payouts.at(-1).payout_id;
  }
}

console.log((await allPayouts("acct_ke_9c2f41b07e5d38a6c1f0b294")).length);
python
import os

import requests

BASE = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"


def all_payouts(account_id):
    payouts, after = [], None
    while True:
        params = {"limit": 100}
        if after:
            params["starting_after"] = after
        res = requests.get(
            f"{BASE}/accounts/{account_id}/payouts",
            params=params,
            headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
            timeout=30,
        )
        answer = res.json()
        if not answer["ok"]:
            raise RuntimeError(f"{res.status_code} {answer['code']}: {answer['description']}")
        payouts.extend(answer["data"]["payouts"])
        if not answer["data"]["has_more"]:
            return payouts
        after = answer["data"]["payouts"][-1]["payout_id"]


print(len(all_payouts("acct_ke_9c2f41b07e5d38a6c1f0b294")))
php
<?php
function all_payouts(string $accountId): array
{
    $base = 'https://payments-ke-staging.mookhpay.co/v1/payments/merchant';
    $payouts = [];
    $after = null;
    while (true) {
        $query = ['limit' => 100];
        if ($after !== null) {
            $query['starting_after'] = $after;
        }
        $ch = curl_init("{$base}/accounts/{$accountId}/payouts?" . http_build_query($query));
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('MOOKHPAY_SECRET_KEY')],
        ]);
        $answer = json_decode(curl_exec($ch), true);
        $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        if (!$answer['ok']) {
            throw new RuntimeException("{$status} {$answer['code']}: {$answer['description']}");
        }
        array_push($payouts, ...$answer['data']['payouts']);
        if (!$answer['data']['has_more']) {
            return $payouts;
        }
        $after = end($answer['data']['payouts'])['payout_id'];
    }
}

echo count(all_payouts('acct_ke_9c2f41b07e5d38a6c1f0b294')), PHP_EOL;

Response ​

200 OK with description Payouts.

json
{
  "ok": true,
  "description": "Payouts",
  "data": {
    "payouts": [
      {
        "payout_id": "po_ke_6b1f0e9a2c7d48e3a5b2c810",
        "account": "acct_ke_9c2f41b07e5d38a6c1f0b294",
        "status": "paid",
        "amount": 500000,
        "fee": 0,
        "total": 500000,
        "currency": "KES",
        "remarks": "Week 47 sales",
        "destination": { "rail": "mpesa", "phone_masked": "+254 7•• ••• 678" },
        "approval_id": null,
        "failure": null,
        "created_at": "2026-11-20T10:00:04.000Z"
      }
    ],
    "has_more": false
  }
}

Response fields ​

FieldTypeMeaning
payoutsarrayUp to limit payout objects, newest first
has_morebooleantrue when there is at least one more payout after the last one here

Errors ​

HTTPCodeNameWhenWhat to do
4001701INVALID_REQUEST_DATAAn unknown query parameter, or limit outside 1 to 100 (limit is 1 to 100)Fix the query
4003012PLATFORM_CURSOR_INVALIDstarting_after is not a payout of this account made by your platformPass a payout_id from the previous page of this account
4003014IDENTITY_HEADER_REFUSEDThe request carries a session or identity headerRemove it
4012781API_KEY_INVALIDMissing, malformed, unknown or revoked keyCheck the key
4032941API_KEY_SCOPE_REQUIREDThe key has neither payouts:write nor accounts:readIssue a key with one of them
4033042API_KEY_IP_NOT_ALLOWEDThe account has allowed addresses and the call came from another addressCall from a listed address
4032942PLATFORM_NOT_ENABLEDYour organisation is not a platform, or its platform is suspendedTalk to MOOKHPay
4033013PLATFORM_IP_NOT_ALLOWEDThe call came from an address not on your platform's allow-listCall from a listed address
4042943PLATFORM_ACCOUNT_NOT_FOUNDThe account is unknown, another platform's, revoked or malformedCheck the id
4093061PLATFORM_ACCOUNT_DISCONNECTEDWhere pockets are on: the person disconnected your platform, or their account closedStop calling for the account until they link again
4291804RATE_LIMIT_EXCEEDEDOver the rate limit, or your platform reached its limit of unknown account idsWait Retry-After seconds
5032782AUTHN_UNAVAILABLEThe key could not be checkedRetry
5033016PLATFORM_ACCOUNTS_UNAVAILABLEThe account could not be readRetry

Rate limit ​

120 requests a minute, shared by every account, balance, transaction, payout read, account link and business account request route your platform calls. 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.