const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantTransactionId: 'invoice_48291',
amount: 150000,
phoneNumber: '+254712345678',
narration: 'Invoice 48291'
})
};
fetch('https://api.fingopay.io/v1/mpesa/charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"merchantTransactionId": "mtx_123",
"transactionId": "txn_01j7b6f9p5y9h"
}
}Initiate an M-Pesa STK Push request to collect payment from a customer. The customer will receive a prompt on their phone to enter their PIN and authorize the payment. Optional fields are advanced; send only required fields unless your integration needs this behavior.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
merchantTransactionId: 'invoice_48291',
amount: 150000,
phoneNumber: '+254712345678',
narration: 'Invoice 48291'
})
};
fetch('https://api.fingopay.io/v1/mpesa/charge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"status": "success",
"message": "Transaction initiated successfully",
"data": {
"merchantTransactionId": "mtx_123",
"transactionId": "txn_01j7b6f9p5y9h"
}
}Use your API key as a Bearer token. Example: Authorization: Bearer sk_live_...
Unique key to safely retry POST without duplicates. Required in live environment.
Merchant-side reference used for reconciliation. Accepts 1-64 characters (letters, numbers, dot, underscore, or hyphen).
1 - 64^[A-Za-z0-9._-]{1,64}$"invoice_48291"
Amount in smallest currency unit (cents). Must be whole KES (divisible by 100). Range 1,000-25,000,000 (KES 10.00-250,000.00).
1000 <= x <= 25000000150000
Customer MSISDN in Kenyan format (+2547/2547/07 or +2541/2541/01 followed by eight digits).
^(?:\+254|254|0)(?:7|1)\d{8}$"+254712345678"
Optional customer-facing narration. Maximum 140 characters.
140"Invoice 48291"
Override webhook destination for this charge.
"https://merchant.example/webhooks/fingo"
[Enterprise] Optional collections shortcode to route the charge via your dedicated shortcode.
"123456"
[Enterprise] Optional internal sub-merchant identifier configured under your organization.
"SM-NAIROBI-001"
Optional custom display name shown to customer (alphanumeric and spaces only, max 40 chars).
40^[a-zA-Z0-9 ]+$"ACME Store"
Accepted — final result will be delivered via webhook.
Was this page helpful?