Professional Documents
Culture Documents
Version 1.0
Introduction
This Interface speci/ication document describes the integration points between a third-
party system and the KCB API Gateway, for the Mpesa Express/STK Push service via KCB
Bank’s paybill 522533.
Prerequisites
The developer/third party needs to register on the API gateway accessible on the
below link.
https://sandbox.buni.kcbgroup.com/devportal/apis
Guide on how to get started in consuming our APIs is available on the following link
https://buni.kcbgroup.com/getting-started
Authentication Token
Use the below curl to generate the token
curl --location 'https://uat.buni.kcbgroup.com/token?grant_type=client_credentials' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic
OOE5NaF9qMWZJeE9seWZhZjQ0NzYTpoYnRZdGQzZTFfX0E3elBHb2ZvY1pKRk5scUFh' \
--data-urlencode 'grant_type=client_credentials'
Method POST
1
Request Parameter Definition
REQUEST PAYLOAD
phoneNumber String(20) Mandatory The mobile number to which the STK Pin Prompt
should be sent.
amount String(30) Mandatory This is the amount to be transferred.
Sample Request
{
"phoneNumber": "254700123456",
"amount": "1",
"invoiceNumber": "KCBTILLNO-YOURACCREF",
"sharedShortCode": true,
"orgShortCode": "",
"orgPassKey": "",
"callbackUrl": "https://posthere.io/f613-4b7f-b82b",
"transactionDescription": "school fee payment"
}
header Mandatory
statusCode String(30) Mandatory Unique code that indicates whether the request
successfully processed or not
statusDescription String(30) Mandatory Provides additional information about the status
of the transaction.
response
2
ResponseCode String(30) Mandatory Unique code that identiVies the status of the
transaction.
CustomerMessage String(30) Mandatory Information that describes the status of the
transaction.
CheckoutRequestID String(10) Boolean Either true or false
Sample Response
{
"response": {
"MerchantRequestID": "7432-920544-1",
"ResponseCode": "0",
"CustomerMessage": "Success. Request accepted for processing",
"CheckoutRequestID": false,
"ResponseDescription": "Success. Request accepted for processing"
},
"header": {
"statusDescription": "Success. Request accepted for processing",
"statusCode": "0"
}
}
Sample Result
{
"Body": {
"stkCallback": {
"MerchantRequestID": "17684-56147665-1",
"CheckoutRequestID": "ws_CO_21072023153404650713165445",
"ResultCode": 0,
"ResultDesc": "The service request is processed successfully.",
"CallbackMetadata": {
"Item": [
{
"Name": "Amount",
"Value": 1.00
},
{
"Name": "MpesaReceiptNumber",
"Value": "ABCDE12345"
},
{
"Name": "Balance"
},
{
"Name": "TransactionDate",
"Value": 20230721153232
},
{
"Name": "PhoneNumber",
"Value": 254700000000
}
]
}
}
}
}
3
HTTP Response Codes
Response code Description