Merchants
Mobile money payment
Charge a customer's M-Pesa or e-Mola wallet; they approve on their phone and you are told the result.
The customer gives their phone number on your site, app or till. You charge it; their phone shows the provider's prompt and they approve with their PIN. The result reaches you by webhook, and you can read it at any time.
Before you start
Your application and its key with payments:write and payments:read (Setting up), and a webhook endpoint for payment.*.
The flow at a glance
| # | Who | What happens |
|---|---|---|
| 1 | Customer | Chooses M-Pesa or e-Mola and gives their phone number. |
| 2 | Your system | Creates the charge with your own payment ID. |
| 3 | Customer | Approves the prompt on their phone with their PIN. |
| 4 | KulPay | Sends payment.succeeded or payment.failed to your webhook. |
| 5 | Your system | Confirms the order, or offers another way to pay. |
1. Create the charge
Your system.
POST /charges · API reference
payment_id is your own unique ID for this payment: the same ID with the same request returns the same payment, so a retry never charges twice. Amounts are decimals ("100.00"). callback_url and return_url are optional.
The answer is usually pending (the prompt is on the customer's phone) or requires_action with a next_action to show the customer (a message, a reference). Show "Approve the payment on your phone" and wait for the result.
Request
{
"payment_id": "ord-2026-10-22-000981",
"money": {
"amount": "100.00",
"currency": "MZN"
},
"source": {
"type": "mobile_wallet",
"mobile_wallet": {
"network": "mpesa",
"phone_number": "+258841234567"
}
},
"customer": {
"name": "Ana Macuácua"
},
"country": "MZ",
"description": "Order 981"
}
Response
{
"payment_id": "ord-2026-10-22-000981",
"provider_payment_id": "3KUXQ43bztiuf9tCMNgbcrYvne3",
"status": "pending",
"money": {
"amount": "100.00",
"currency": "MZN"
},
"source": {
"type": "mobile_wallet",
"mobile_wallet": {
"network": "mpesa",
"phone_number": "+258841234567"
}
}
}
2. Wait for the result
KulPay, then your system.
payment.succeeded or payment.failed arrives at your webhook. Verify it, then read the payment back before you ship anything (next step). Do not wait forever: a customer who ignores the prompt ends in failed or expired.
3. Read the payment
Your system.
GET /payments/{provider_payment_id} · API reference
By KulPay's ID, or by your own with GET /payments?payment_id=…. Use it to confirm a webhook, and when a webhook did not arrive.
Response
{
"payment_id": "ord-2026-10-22-000981",
"provider_payment_id": "3KUXQ43bztiuf9tCMNgbcrYvne3",
"status": "succeeded",
"money": {
"amount": "100.00",
"currency": "MZN"
},
"mode": "live",
"amount_minor": 10000,
"connector_ref": "MP261022.0930.A12345",
"settled_at": "2026-10-22T09:30:12Z"
}
States
| State | What it means |
|---|---|
pending | The prompt is on the customer's phone. |
requires_action | Show the customer the |
succeeded | Paid. Fulfil the order. |
failed | Refused (insufficient funds, rejected, wrong PIN, provider error). Offer another way to pay. |
expired | The customer did not approve in time. |
When the money moves
The customer's wallet is debited when they approve; the payment is succeeded then. Where the money lands (your own provider account, or KulPay's for settlement to you) depends on your arrangement: see Getting paid.
Events
| Event | What it tells you |
|---|---|
payment.succeeded | Paid. |
payment.failed | Refused or failed. |
payment.expired | Not approved in time. |
Errors that matter here
Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.
| Error | When | What to do |
|---|---|---|
400 invalid_request | A field is missing, or the phone number does not fit the network. | Fix it; check the number belongs to the network chosen. |
409 idempotency_key_reused | The | A new payment, a new ID. |
409 no_connector_binding | Your application has no account for this method. | Connect one, or use KulPay's collection. |
422 limit_exceeded | The amount breaks a limit; the problem names the rule. | Lower the amount, or ask about your limits. |
Testing it
Use the test numbers in Test mode: +258840000001 succeeds, +258840000002 has no funds, +258840000003 is rejected, +258840000004 times out, +258840000005 succeeds without a webhook.