M-Pesa Mobile Money Payout (Kenya)
This guide explains how to integrate mobile money payouts to M-Pesa wallets in Kenya using PayOS.
Overview
M-Pesa is Kenya’s leading mobile money service, enabling businesses to send payouts directly to recipient mobile wallets. By integrating M-Pesa payouts with PayOS, you can efficiently disburse funds to recipients across Kenya.
Supported Currency & Country
Request Structure
M-Pesa payouts in Kenya require the following structure:
Required Fields
Top-Level Fields:
merchantId: Your merchant identifiermerchantReference: Unique reference for this payout (UUID recommended)amount: Amount in minor units (e.g.,2000= 20.00 KES)currency: Currency code (KES)paymentMethodId: Set to"mobilemoney"paymentLocation: Set to"KEN"for Kenyaattributes: Can be an empty object{}or contain additional attributes
Recipient Fields:
recipient.type: Set to"mobile_money"recipient.name: Full name of the recipientrecipient.operator: Set to"mpesa"recipient.country: Set to"KEN"for Kenyarecipient.phoneNumber: Recipient’s M-Pesa registered phone number
Usage Example
Expected Response:
Phone Number Format
Phone numbers are automatically normalized to the required international format (e.g., adding the country code if missing, stripping + prefix). You can provide numbers in either local (e.g., 07...) or international (e.g., +254... or 254...) format.
Valid Phone Number Formats
Amount Limits
M-Pesa enforces the following limits on payouts:
Note: Amounts are specified in minor units. For KES, the minor unit is cents, so
2000represents 20.00 KES.
Error Codes
The following error codes may be returned for M-Pesa payout failures:
Important Notes
-
Operator Code: Always use
"mpesa"as the operator code for M-Pesa payouts in Kenya. -
Country Code: Use the 3-letter ISO country code
"KEN"for bothpaymentLocationandrecipient.country. -
Currency: Only
KES(Kenyan Shilling) is supported for M-Pesa payouts in Kenya. -
Asynchronous Processing: Payouts are processed asynchronously. After submission, the initial status will be
Pending. Monitor the final status via webhooks or by polling the transaction status endpoint. -
Idempotency: Use unique
merchantReferencevalues for each payout request. Duplicate references will be rejected to prevent duplicate payouts.
Best Practices
-
Monitor Webhook Events: Ensure your webhook handlers correctly process status updates for both successful and failed payouts.
-
Validate Phone Numbers: Before submitting payouts, validate that recipient phone numbers are in a valid format to reduce failed transactions.
Next Steps
Contact your account manager to enable M-Pesa payouts for your merchant account.