Mpesa
Flutterwave allows merchants to use two payment methods in Kenya (card and Mpesa).
Let us show you how to accept payments using MPesa.
Pre-requisites for accepting payments in Kenya.
-
Sign-up for an account here .
-
Set up a webhook to get notified on payments, to see more on webhooks visit our Webhook section.
-
When trying to accept payment on a website you can use our Flutterwave inline method and pass
currency
asKES
andcountry
asKE
, once you do this, the payment options for card and MPesa will be enabled. -
If you would prefer to accept payments using our APIs please see how to accept mobile money payments via APIs.
-
After getting a response for the transaction, call the Verify transaction endpoint to confirm the final status of the transaction.
Step 1 - Initiate payment
Send your payload to our charge endpoint: hhttps://api.flutterwave.com/v3/charges?type=mpesa
Method: POST
{
"tx_ref": "MC-15852113s09v5050e8",
"amount": "1500",
"currency": "KES",
"email": "[email protected]",
"phone_number": "054709929220",
"fullname": "Ekene Eze"
}
Parameter Definition
Parameter | Required | Description |
---|---|---|
tx_ref | True | This is a transaction reference you supply to identify different transactions on your account. It is important to ensure that you pass unique references for every transaction. |
amount | True | This is the amount to be charged. It is passed in KES - ('amount':'100'). |
currency | True | This is the specified currency to charge in. (expected value: KES) |
True | This is the email address of the customer. | |
phone_number | True | This is the phone number linked to the customer's mobile money account. |
client_ip | False | Internet Protocol. This represents the current IP address of the customer carrying out the transaction. |
device_fingerprint | False | This is the fingerprint for the device being used. It can be generated using a library on whatever platform is being used. |
meta | False | This is an object you can use to include any additional payment information you would like to associate with this charge |
fullname | False | Should include the first and last name of the customer |
Payment Response
When you send your payload to our charge endpoint to make a payment, you'll get a successful response if it all goes well.
{
"status": "success",
"message": "Charge initiated",
"data": {
"id": 1191376,
"tx_ref": "MC-15852113s09v5050e8",
"flw_ref": "2899902722",
"device_fingerprint": "62wd23423rq324323qew1",
"amount": 1500,
"charged_amount": 1500,
"app_fee": 21,
"merchant_fee": 0,
"processor_response": "Successful",
"auth_model": "LIPA_MPESA",
"currency": "KES",
"ip": "154.123.220.1",
"narration": "FLW-PBF MPESA Transaction ",
"status": "success-pending-validation",
"auth_url": "N/A",
"payment_type": "mpesa",
"fraud_status": "ok",
"charge_type": "normal",
"created_at": "2020-03-27T15:46:37.000Z",
"account_id": 74843,
"customer": {
"id": 349271,
"phone_number": "25454709929220",
"name": "John Madakin",
"email": "[email protected]",
"created_at": "2020-03-27T15:46:13.000Z"
}
}
}
Verify payment
After charging a customer successfully, you need to verify that the payment was successful with Flutterwave before giving value to your customer on your website.
Visit our Transaction verification section to learn more about transaction verifications and how to implement it in different languages.
Updated about 2 years ago