Kenyan Shilling (KES) Payouts
This guide explains how to integrate Mavapay’s payout functionality for sending money to Kenyan recipients through various M-Pesa payment modes.Overview
The KES payout process involves the following steps:- Choose the appropriate M-Pesa payment mode
- Create a quote with the required beneficiary details
- Pay the generated lightning invoice
- Receive webhook notifications for payment status
Prerequisites
Before you begin, ensure you have:- Created a Mavapay account
- Obtained your API key
- Set up your webhook endpoint
- Verified your business account
Authentication
All API requests must include your API key in the header:- All amounts are in cents (1 KES = 100 cents)
- The minimum amount for KES payouts is $2
- Phone numbers must be in international format (e.g., +254…)
- Account numbers for paybill payments can be text (usually business name or identifier)
- All payments are processed through M-Pesa’s payment infrastructure
Payment Modes
All KES payments are processed through M-Pesa using one of the following modes:1. Pay to Phone Number (M-Pesa Mobile Money)
Send money directly to a recipient’s M-Pesa account:2. Pay to Bill (M-Pesa Paybill)
Pay to a business using their M-Pesa paybill number:3. Pay to Account/Till (M-Pesa Till)
Pay to a business M-Pesa till number:Understanding the Quote Response
Sample response:usdToTargetCurrencyRate
: Price of 1 USD in KESexchangeRate
: Price of 1 BTC in KESamountInSourceCurrency
: Total amount in SATS to be paid (including fees)amountInTargetCurrency
: Total amount in cents to be sent to recipienttransactionFeesInSourceCurrency
: Fees in SATStransactionFeesInTargetCurrency
: Fees in centsexpiry
: Invoice validity (5 minutes)
Webhook Events
You’ll receive two webhook events:payment.received
- When the lightning payment is receivedpayment.sent
- When the money is sent to the recipient
payment.received Event
payment.sent Event
Checking Transaction Status
You can query transactions using the payment hash, orderId, or transaction ID:Getting Price Rates
To get current KES rates:Testing
Use our staging environment for testing:- Phone Number:
+254790000000
- Paybill Number:
4141031
- Account Number:
test_account
- Till Number:
000000
Support
If you need help with integration:- Email: info@mavapay.co
- Documentation: https://docs.mavapay.co
- API Reference: https://docs.mavapay.co/api-reference