Skip to content

Direct charges ​

A direct charge takes a payment from your server while the payer stays on your own screen. There is no redirect. For mobile money, one call creates the payment and sends the prompt to the payer's phone at once. For M-Pesa Pay Bill, the call answers the numbers to show the payer. For a card, it answers a secret for the card element on your page.

Underneath, a charge is a checkout and its payment attempt. Booking, receipts, Pay Bill matching, the test numbers and the payment.* webhooks work as they do for a hosted checkout.

Charge or hosted checkout ​

Direct chargeHosted checkout
The payerStays in your app or siteGoes to MOOKHPay's page, then back
You buildThe screen that asks for the number and waitsNothing beyond a redirect
Ways to payMobile money prompt, M-Pesa Pay Bill, card through the card elementMobile money, Pay Bill, card, MOOKHPay balance
A failed promptEnds the charge. Create a new one to try againThe payer tries again on the same checkout
Scopecharges:writecheckouts
Test modeEvery charge from a staging key (mkp_test_) is a test chargeNone for a secret key

Every charge also has a hosted_url: the same payment on the hosted page. Give it to the payer if the prompt does not arrive.

Get a key with charges:write ​

A key made with no choice of scopes does not have charges:write. In an organisation only an Owner can be issued one: the Owner chooses Direct Charges (charges:write) on Create A Key or Replace Key in the hub, along with any other scopes the integration uses, and enters their PIN. Replacing a key keeps the old one working for 24 hours, so you can deploy the new key first. See API keys and scopes.

A key without the scope answers 403 and code 2941.

Create a mobile-money charge ​

Call POST /charges with an Idempotency-Key. The prompt goes to phone before the answer comes back.

sh
curl -X POST https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY" \
  -H "Idempotency-Key: order-8841-1" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 150000,
    "reference": "order-8841",
    "description": "Order 8841",
    "payment_method": { "type": "mobile_money", "phone": "+254700000000" },
    "payer_email": "payer@example.com",
    "metadata": { "cart": "8841", "channel": "pos" }
  }'
js
const API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

const res = await fetch(`${API}/charges`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}`,
    "Idempotency-Key": "order-8841-1",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    amount: 150000,
    reference: "order-8841",
    description: "Order 8841",
    payment_method: { type: "mobile_money", phone: "+254700000000" },
    payer_email: "payer@example.com",
    metadata: { cart: "8841", channel: "pos" },
  }),
});
const body = await res.json();
if (!body.ok) throw new Error(`${body.code}: ${body.description}`);
console.log(body.data.id, body.data.next_action);
python
import os
import requests

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

res = requests.post(
    f"{API}/charges",
    headers={
        "Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}",
        "Idempotency-Key": "order-8841-1",
    },
    json={
        "amount": 150000,
        "reference": "order-8841",
        "description": "Order 8841",
        "payment_method": {"type": "mobile_money", "phone": "+254700000000"},
        "payer_email": "payer@example.com",
        "metadata": {"cart": "8841", "channel": "pos"},
    },
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(f"{body['code']}: {body['description']}")
print(body["data"]["id"], body["data"]["next_action"])
php
<?php
$api = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

$ch = curl_init("$api/charges");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY"),
        "Idempotency-Key: order-8841-1",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "amount" => 150000,
        "reference" => "order-8841",
        "description" => "Order 8841",
        "payment_method" => ["type" => "mobile_money", "phone" => "+254700000000"],
        "payer_email" => "payer@example.com",
        "metadata" => ["cart" => "8841", "channel" => "pos"],
    ]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body["ok"]) {
    throw new RuntimeException($body["code"] . ": " . $body["description"]);
}
echo $body["data"]["id"], "\n";

+254700000000 is a test number: on a staging key it succeeds after about 3 seconds with no prompt. On a production key, use the payer's real number.

The answer is 201:

json
{
  "ok": true,
  "description": "Charge created",
  "data": {
    "id": "ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f",
    "status": "pending",
    "test": true,
    "amount": 150000,
    "currency": "KES",
    "fee": 0,
    "net": 150000,
    "reference": "order-8841",
    "description": "Order 8841",
    "payment_method": { "type": "mobile_money", "rail": "mpesa", "phone": "+254 7•• ••• 000" },
    "next_action": {
      "type": "await_payer",
      "expires_at": "2026-11-20T10:06:00.000Z",
      "display": "Enter your M-Pesa PIN on your phone"
    },
    "failure": null,
    "receipt_number": null,
    "hosted_url": "https://mookhpay.co/checkout/cs_ke_1b2c3d4e5f6a7b8c9d0e1f2a",
    "metadata": { "cart": "8841", "channel": "pos" },
    "expires_at": "2026-11-20T10:06:00.000Z",
    "created_at": "2026-11-20T10:00:00.000Z"
  }
}

Charge amounts are numbers, unlike a checkout's strings. The phone comes back masked to its first four and last three digits.

What you can send ​

Unknown fields are refused with 400 and code 1701, at the top level and inside payment_method.

FieldTypeRequiredRules
amountintegerYesMinor units, 1 to 100,000,000,000, and inside the rail's collection limits (KES 1 to KES 150,000 on M-Pesa; UGX 1 to UGX 5,000,000 in whole shillings on MTN MoMo). Outside them: 422 and code 2702
referencestringYesYour order id, 1 to 64 characters. One pending charge per reference at a time
descriptionstringNo1 to 140 characters. Shown on the hosted page at hosted_url
payment_methodobjectYesOne of the three shapes below
payer_emailstringNoUp to 254 characters, for the payer's receipt. mobile_money and card only; with paybill it answers 400 and code 1701. A malformed address answers 400 and code 1701
metadataobjectNoUp to 20 pairs. Keys 1 to 40 characters, values strings of up to 500 characters. Comes back on every read and on the webhooks
on_behalf_of, platform_feeNoPlatforms only. See Take payments with a fee
payment_methodFields
{ "type": "mobile_money", "phone": "…" }phone: the payer's number with its country code, + optional, such as +254712345678. It must be a number the deployment's rail can prompt: 254 and 9 digits on M-Pesa, 256 and 9 digits on MTN MoMo, otherwise 400 and code 1701. Optional rail: mpesa or momo. A rail this deployment does not run answers 422 and code 2701
{ "type": "paybill" }Nothing else. Kenya only, where Pay Bill is on, and never on a staging key. Elsewhere 400 and code 3004
{ "type": "card" }Nothing else. Production keys only, where cards are on. See Card payments

Create a Pay Bill charge ​

A paybill charge sends no prompt. It answers a Pay Bill number and an account number for the payer to pay from the M-Pesa menu. It is offered on Kenya with a production key, where Pay Bill is switched on.

sh
curl -X POST https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY" \
  -H "Idempotency-Key: order-8842-1" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 250000,
    "reference": "order-8842",
    "payment_method": { "type": "paybill" }
  }'
js
const API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

const res = await fetch(`${API}/charges`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}`,
    "Idempotency-Key": "order-8842-1",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    amount: 250000,
    reference: "order-8842",
    payment_method: { type: "paybill" },
  }),
});
const { ok, data, code, description } = await res.json();
if (!ok) throw new Error(`${code}: ${description}`);
const { business_number, account_number, amount } = data.next_action;
console.log(`Pay Bill ${business_number}, account ${account_number}, KES ${amount / 100}`);
python
import os
import requests

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

res = requests.post(
    f"{API}/charges",
    headers={
        "Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}",
        "Idempotency-Key": "order-8842-1",
    },
    json={
        "amount": 250000,
        "reference": "order-8842",
        "payment_method": {"type": "paybill"},
    },
    timeout=30,
)
body = res.json()
if not body["ok"]:
    raise RuntimeError(f"{body['code']}: {body['description']}")
action = body["data"]["next_action"]
print(f"Pay Bill {action['business_number']}, account {action['account_number']}, KES {action['amount'] / 100:.2f}")
php
<?php
$api = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

$ch = curl_init("$api/charges");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY"),
        "Idempotency-Key: order-8842-1",
        "Content-Type: application/json",
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "amount" => 250000,
        "reference" => "order-8842",
        "payment_method" => ["type" => "paybill"],
    ]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
if (!$body["ok"]) {
    throw new RuntimeException($body["code"] . ": " . $body["description"]);
}
$action = $body["data"]["next_action"];
printf("Pay Bill %s, account %s, KES %.2f\n", $action["business_number"], $action["account_number"], $action["amount"] / 100);

On a staging key this call answers 400 and code 3004, because a staging key makes test charges and test charges are mobile money only.

The payer must pay the exact amount. A different amount still lands in your main wallet as an ordinary payment, but it does not pay the charge, and you reconcile it yourself.

Card charges ​

{ "type": "card" } answers next_action.type use_card_element with a client_secret. Your server hands the secret to your checkout page, and the card element (mookhpay.js) takes the card there, so card numbers never reach your server. The page must be on the list of origins an Owner saved for card payments.

  • Card charges are refused with 400 and code 3004 on a staging key (mkp_test_), and wherever cards are not switched on. They cannot be tested end to end on staging.
  • A card charge stays pending for the card attempt's life: 30 minutes by default (CARD_UC_INTENT_TTL_SECONDS).
  • A declined card leaves the charge pending, so the payer can try another card. If it expires, failure carries the last decline (or null), and payment.failed follows only when the element had opened a card attempt and nothing is still in flight.
  • The payer pays the amount plus a card fee; you receive the amount. next_action.fee and next_action.total give both.

The whole flow is in Card payments.

Lifecycle ​

statusMeaningDo this
pendingWaiting for the payerShow next_action and wait
succeededThe money is bookedFulfil once
failedThe payer or the rail refused. failure says whyTell the payer. Offer a new charge
expiredNo answer by expires_atOffer a new charge, or hosted_url
cancelledYou cancelled itNothing

succeeded is set only once the ledger booking is done, which is the moment payment.succeeded is sent. A charge never leaves succeeded.

A charge that ended can still become succeeded. A prompt already on the payer's phone cannot be recalled, and a Pay Bill payment can arrive after the window. When such a payment is booked, the charge moves to succeeded and payment.succeeded is sent. MOOKHPay sweeps for these for 7 days after a charge was due to end, and every read of a charge checks again. Do not fulfil on expired, failed or cancelled, and keep listening for payment.succeeded on those charges.

How long a charge stays pending:

payment_methodexpires_at by default
mobile_money6 minutes: the prompt's life (INTENT_TTL_SECONDS, 300) and a grace period (CHARGE_PROMPT_GRACE_SECONDS, 60)
paybill30 minutes (CHARGE_PAYBILL_WINDOW_SECONDS, 1800)
card30 minutes (CARD_UC_INTENT_TTL_SECONDS, 1800)

Read expires_at from the charge rather than relying on these numbers.

What to show the payer ​

next_action is set while the charge is pending, and null once it ends. Branch on next_action.type.

typeFieldsShow
await_payerdisplay, expires_atdisplay ("Enter your M-Pesa PIN on your phone" or "Approve the MTN MoMo prompt on your phone") and a countdown to expires_at
pay_to_paybillbusiness_number, account_number, amount, expires_at"Pay Bill business_number, account account_number, amount" and the time left. amount is in minor units: 250000 is KES 2,500.00
use_card_elementclient_secret (create answer only), expires_at, amount, fee, total, currencyMount the card element with client_secret. Show total as what the card is charged

Learn the outcome ​

The webhook is the source of truth. Polling is for the screen the payer is looking at.

Webhooks ​

Subscribe your endpoint to these events. See Event catalogue for full payloads.

EventWhenCharge fields in it
payment.succeededThe charge's payment was bookedcharge, reference, metadata, failure (null), test
payment.failedThe charge's payment failed (a mobile-money refusal, or a card charge that expired after the element opened a card attempt)charge, reference, metadata, failure, test
charge.expiredThe charge reached expires_at while pendingcharge, reference, metadata, status, test
charge.cancelledYou cancelled the chargecharge, reference, metadata, status, test

There is no charge.succeeded or charge.failed: success and failure arrive as payment.succeeded and payment.failed, carrying charge. charge.expired and charge.cancelled go only to whoever made the charge: you, or the platform that made it for you.

Polling ​

While the payer waits on your screen, read GET /charges/{id} every 2 seconds. Stop when status leaves pending, or at expires_at.

sh
curl https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges/ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const headers = { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` };

export async function waitForCharge(id, expiresAt) {
  while (Date.now() < Date.parse(expiresAt)) {
    const res = await fetch(`${API}/charges/${id}`, { headers });
    const body = await res.json();
    if (!body.ok) throw new Error(`${body.code}: ${body.description}`);
    if (body.data.status !== "pending") return body.data;
    await new Promise((resolve) => setTimeout(resolve, 2000));
  }
  return null;
}
python
import os
import time
from datetime import datetime

import requests

API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant"
HEADERS = {"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"}


def wait_for_charge(charge_id, expires_at):
    deadline = datetime.fromisoformat(expires_at.replace("Z", "+00:00")).timestamp()
    while time.time() < deadline:
        body = requests.get(f"{API}/charges/{charge_id}", headers=HEADERS, timeout=15).json()
        if not body["ok"]:
            raise RuntimeError(f"{body['code']}: {body['description']}")
        if body["data"]["status"] != "pending":
            return body["data"]
        time.sleep(2)
    return None
php
<?php
function waitForCharge(string $id, string $expiresAt): ?array
{
    $api = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
    $deadline = strtotime($expiresAt);
    while (time() < $deadline) {
        $ch = curl_init("$api/charges/$id");
        curl_setopt_array($ch, [
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY")],
        ]);
        $body = json_decode(curl_exec($ch), true);
        curl_close($ch);
        if (!$body["ok"]) {
            throw new RuntimeException($body["code"] . ": " . $body["description"]);
        }
        if ($body["data"]["status"] !== "pending") {
            return $body["data"];
        }
        sleep(2);
    }
    return null;
}

Reads share 120 requests a minute with your checkout calls. One payer polled for one prompt fits in that; many payers at once do not, so rely on webhooks for those.

client_secret is never in a read. Only the create answer and its idempotent replay carry it.

Find a charge whose answer was lost ​

If the create call timed out, you do not know whether a prompt was sent. Either repeat the create with the same Idempotency-Key and body, which answers the same charge with 200 and sends no second prompt, or look the charge up by your reference with GET /charges?reference=. It lists the charges you made for that reference, newest first, whichever account they pay. limit is 1 to 100, 20 by default.

sh
curl "https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges?reference=order-8841&limit=5" \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
const params = new URLSearchParams({ reference: "order-8841", limit: "5" });

const res = await fetch(`${API}/charges?${params}`, {
  headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const body = await res.json();
if (!body.ok) throw new Error(`${body.code}: ${body.description}`);
for (const charge of body.data.charges) console.log(charge.id, charge.status);
python
import os
import requests

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

body = requests.get(
    f"{API}/charges",
    params={"reference": "order-8841", "limit": 5},
    headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
    timeout=15,
).json()
if not body["ok"]:
    raise RuntimeError(f"{body['code']}: {body['description']}")
for charge in body["data"]["charges"]:
    print(charge["id"], charge["status"])
php
<?php
$api = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";
$query = http_build_query(["reference" => "order-8841", "limit" => 5]);

$ch = curl_init("$api/charges?$query");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY")],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
foreach ($body["data"]["charges"] as $charge) {
    echo $charge["id"], " ", $charge["status"], "\n";
}

The answer is { "charges": [ … ] }, each charge as GET /charges/{id} answers it. There is no cursor: this is a lookup by reference, not a list of every charge.

Retries and one charge per reference ​

  • Send an Idempotency-Key on every create, 1 to 128 characters. The same key with the same body answers the same charge with 200, and no second prompt is sent.
  • The same key with a different body answers 422 and code 3015.
  • One pending charge per reference. A second create for a reference whose charge is still pending answers 409 and code 3002, with data.charge naming the pending charge. This stops a double click or a client retry sending two prompts for one order.
json
{
  "ok": false,
  "description": "A charge for this reference is still pending. Wait for it, or cancel it first",
  "data": { "charge": "ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f" },
  "code": 3002
}
  • Once that charge has ended (failed, expired or cancelled), a new charge for the same reference is allowed. Use a new Idempotency-Key for it.
  • Idempotency keys and references are your own. A platform's never collide with the seller's.

Use the order id as reference, and the order id with the attempt number as the Idempotency-Key, such as order-8841-2.

Failure codes ​

failure is { code, message } on a failed charge and null otherwise. Branch on code. message is a plain sentence for your logs. The list is closed: a rail answer MOOKHPay does not map becomes declined.

codeMeaningProduced byTell the payer
payer_cancelledThe payer cancelled the promptM-Pesa, MoMo, test number 0700 000 003"You cancelled the payment. Try again when you're ready."
insufficient_fundsNot enough money for this paymentM-Pesa, MoMo, card, test number 0700 000 001"There wasn't enough money for this payment. Top up and try again, or use another number."
wrong_pinThe payer entered a wrong PINM-Pesa"The PIN was wrong. Try again."
prompt_timed_outThe prompt was not answered in timeM-Pesa, MoMo, test number 0700 000 002"The payment request timed out. Try again and approve it on your phone."
phone_unreachableThe phone could not be reachedM-Pesa, MoMo"We couldn't reach your phone. Check it is on and has signal, then try again."
limit_exceededOver a limit on the payer's accountM-Pesa, MoMo, card"This payment is over a limit on your account. Try a smaller amount or another number."
rail_unavailableThe payment network could not take the paymentM-Pesa, MoMo, card"The payment network is not responding. Try again in a few minutes."
declinedDeclined for any other reason, or a rail answer with no mappingM-Pesa, MoMo, card"The payment was declined. Try again, or use another method."

Cancel a charge ​

POST /charges/{id}/cancel stops a pending charge being paid. It takes no body.

sh
curl -X POST https://payments-ke-staging.mookhpay.co/v1/payments/merchant/charges/ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f/cancel \
  -H "Authorization: Bearer $MOOKHPAY_SECRET_KEY"
js
const API = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

const res = await fetch(`${API}/charges/ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f/cancel`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MOOKHPAY_SECRET_KEY}` },
});
const body = await res.json();
if (!body.ok) throw new Error(`${body.code}: ${body.description}`);
console.log(body.data.status);
python
import os
import requests

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

body = requests.post(
    f"{API}/charges/ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f/cancel",
    headers={"Authorization": f"Bearer {os.environ['MOOKHPAY_SECRET_KEY']}"},
    timeout=15,
).json()
if not body["ok"]:
    raise RuntimeError(f"{body['code']}: {body['description']}")
print(body["data"]["status"])
php
<?php
$api = "https://payments-ke-staging.mookhpay.co/v1/payments/merchant";

$ch = curl_init("$api/charges/ch_ke_8a3f0c2d9b1e4f5a6c7d8e9f/cancel");
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("MOOKHPAY_SECRET_KEY")],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $body["data"]["status"] ?? $body["code"], "\n";
  • A paybill charge stops matching at once. A menu payment after that lands in your main wallet as an ordinary payment and does not pay the charge.
  • The hosted page at hosted_url stops taking new attempts.
  • A prompt already on the payer's phone cannot be recalled. If the payer approves it, the payment is booked and the charge becomes succeeded.
  • Only a pending charge can be cancelled. Any other status answers 409 and code 3003. Cancelling a charge already cancelled answers it again with 200.
  • No body, or {}. A non-empty body answers 400 and code 1701.
  • Only the merchant or platform that made the charge can cancel it. A seller reading a charge a platform made for them gets 404 and code 3001 on cancel.
  • charge.cancelled is sent.

Test charges ​

A charge made with a staging key (mkp_test_) is a test charge, with "test": true. It is paid only by the four test numbers, in the deployment's own country code. No prompt is sent and nothing is booked, but the charge, the webhooks and the failure codes go through the same states as a real one.

KeyA real numberA test number
mkp_test_ (staging)409, code 2836Simulated. The number decides the outcome
mkp_live_ (production)A real prompt422, code 2838
NumberOutcomeAfter
0700 000 000succeededAbout 3 seconds
0700 000 001failed, insufficient_fundsAbout 3 seconds
0700 000 002failed, prompt_timed_outAbout 60 seconds
0700 000 003failed, payer_cancelledAbout 3 seconds

Send them as +254700000000 in Kenya or +256700000000 in Uganda. A test charge is mobile money only: paybill and card answer 400 and code 3004.

Limits ​

Prompts are limited so nobody can be pestered through MOOKHPay. Over any of the first three, the create answers 429 and code 3005, with Retry-After and data.retryAfter in seconds.

LimitDefaultCounts
Prompts to one phone number, across every merchant5 an hourmobile_money creates (CHARGE_PROMPTS_PER_PHONE). Test numbers are counted per merchant instead
Prompts to one phone number from your account3 an hourmobile_money creates (CHARGE_PROMPTS_PER_PHONE_MERCHANT)
Charges created by your key's account300 an hourEvery create, any method (CHARGES_PER_KEY)
Reads, lists and cancels120 a minute, code 1804Shared with your checkout calls

The amount is checked against the rail before the prompt. See Limits and rate limits.

Refusals when you create ​

HTTPCodeWhen
4001701A field breaks its rules, a field is unknown, Idempotency-Key is missing, metadata breaks its rules, the phone is not one the rail can prompt, or payer_email is malformed or sent with paybill
4003004paybill or card is not offered here, or the key is a staging key
4012781The key is missing, malformed, unknown or revoked
4032941The key does not have charges:write
4092709The payee's wallet is not set up yet. Try again in a moment
4092836A real number on a test charge
4093002A charge for this reference is still pending. data.charge names it
4222701rail is not the rail this deployment runs
4222702amount is outside the rail's limits
4222721Payments are switched off on this deployment
4222838A test number on a production key
4223015The Idempotency-Key was used with a different body
4293005A prompt or charge limit above
5032752, 2782The ledger or the key service did not answer. Retry with the same Idempotency-Key

The full list, with the platform codes, is on Create a charge.

For platforms ​

A platform adds on_behalf_of and platform_fee to take a payment for a seller with its fee. The key also needs payments:write, the seller is the payee and the prompt names them, and the charge carries account, platform_fee and net. See Take payments with a fee.

Not offered ​

  • Paying from a MOOKHPay balance. That needs the payer's own MOOKHPay session; send them to hosted_url.
  • Saved cards, recurring charges, or charging a card you hold.
  • Retrying a failed prompt on the same charge. Create a new charge.
  • Refunds on this route. A paid charge is refunded with POST /refunds and its charge_id. See Refunds.

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