Accept Payment
Server to Server Momo Collection
The mobile money payment request API allows you to accept momo payment from your customer directly from your application or custom checkout.
- Pass your secret key as the Bearer token in Authorization Header.
Momo Payment Providers
Endpoint: /momo/providers/{cur}
Method: GET
Header
Param | Type | Required? | Decription |
---|---|---|---|
authorization | string | Yes | Set value to Bearer SECRET_KEY |
content-type | string | Yes | Set value to application/json |
Path Params
Param | Type | Required? | Decription |
---|---|---|---|
currency | string | Yes | Set value to checkout currency (only KES currently supported) |
Sample Post KES
curl https://api.budpay.com/api/s2s/v2/momo/providers/KES
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-X GET
Sample Post GHS
curl https://api.budpay.com/api/s2s/v2/momo/providers/GHS
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-X GET
Sample Response KES
{
"status": true,
"message": "Momo Collection Providers Fetched",
"currency": "KES",
"banks": [
{
"name": "MPesa",
"code": "63902"
},
{
"name": "AirtelMoney",
"code": "63903"
},
{
"name": "T-Kash",
"code": "63907"
}
]
}
Sample Response GHS
{
"status": true,
"message": "Momo Collection Providers Fetched",
"currency": "GHS",
"banks": [
{
"name": "Airtel",
"code": "AIR"
},
{
"name": "Tigo",
"code": "TIG"
},
{
"name": "Vodafone",
"code": "VOD"
},
{
"name": "MTN",
"code": "MTN"
},
{
"name": "MasterCard",
"code": "MAS"
},
{
"name": "Bank",
"code": "BNK"
},
{
"name": "VISA",
"code": "VIS"
}
]
}
Momo Payment Request
Endpoint: /momo/payment_request
Method: POST
Header
Param | Type | Required? | Decription |
---|---|---|---|
authorization | string | Yes | Set value to Bearer SECRET_KEY |
content-type | string | Yes | Set value to application/json |
Query Params
Param | Type | Required? | Decription |
---|---|---|---|
amount | string | Yes | Set value to payment amount. no decimal place allowed. |
currency | string | Yes | Set value to checkout currency (GHS or KES) |
bankName | string | Yes | Set value to mobile money provider |
bankCode | string | Yes | Set value to mobile money provider code. |
name | string | Yes | Set value to mobile money provider |
phone | string | Yes | Set value to payer's phone number |
description | string | Yes | Set value to payment details or purpose |
reference | string | Yes | Set value to your unique reference number |
callbackUrl | string | Yes | Set value to prefered url to get notified of payment status with key details to identify payment |
Sample Post
curl https://api.budpay.com/api/s2s/v2/momo/payment_request
-H "Authorization: Bearer YOUR_SECRET_KEY"
-H "Content-Type: application/json"
-d '{ "amount": "10", "bankName": "Airtel", "name": "Airtel", "bankCode": "AIR", "callbackUrl" :"http://your_callback_url", "currency" :"GHS", "description": "Server to Server test", "phone": "+233567467333", "reference": "12536xxxxxxxx6350" }'
-X POST
Sample Response KES
{
"success": true,
"detail": "MPESA STK sent. Enter your PIN to complete transaction",
"ResponseDescription": "Success. STK PUSH SENT",
"CustomerMessage": "1. GO TO 'LIPA NA MPESA' 2. SELECT 'PAY BILL' 3. ENTER BUSINESS NUMBER: 756756 4. ENTER ACCOUNT NUMBER: PR4571313_BUD INFRASTUCTURE LIMITED 5. ENTER AMOUNT:10 6. ENTER YOUR MPESA PIN AND PRESS OK"
}
Sample Response GHS
{
"success": true,
"detail": "Request Sent",
"ResponseDescription": "Request successfully received for processing",
"CustomerMessage": "Kindly complete transaction on your phone"
}
Sample Momo Payment Callback
Endpoint: your_callback_url
Method: POST
Header
Param | Type | Required? | Decription |
---|---|---|---|
content-type | string | Yes | Set value to application/json |
Sample Body
{
"status": "success",
"event": "collection",
"channel": "momo",
"currency": "KES",
"amount": "10",
"fee": "1",
"requested_amount": "10",
"type": "transaction",
"reference": "BUD_16871757xxxxxxx57",
"phone": "25471xxxxxxx",
"PaymentGateway": "MPesa",
"MerchantRequestID": "BUD_16871757xxxxxxx57",
"CheckoutRequestID": "5ecd1799-c91b-xxxx-xxxx-xxxxxxxxd421",
"domain": "live",
"timestamp": "2023-06-19 12:05:00"
}