OVERVIEWLast updated: 20-01-2023

Kyanda API merchant service is engineered to create simple APIs that perform multiple complex functions. From a single payment APIs that make payments to mobile wallets, banks and cards to single Utility Vending that allows Bill Payments across multiple Telco’s and multiple digital service providers.

Note

Live Endpoint To be shared by Kyanda Team

API ACCOUNT

Building great products. We abstract all the complexity and present easy-to-integrate APIs for you.

AUTHENTICATION AND AUTHORIZATION

Standard Request Headers

The standard request headers needed when authenticating with the API across all requests are:


FIELD DESCRIPTION
Content-Type The content type of the payload: application/json
apiKey This Key is generated upon registration.

API ACCOUNT

i. Check Account Balance

This Request fetches the Available Account Balances in the Payment and Billing platform.

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters:

FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
signature A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields with the following order:

MerchantID

The resulting string is then signed with the Key Provided upon registration.

  
    Example Request:

    POST /billing/v1/account-balance HTTP/1.1
    Host:  {GatewayBaseURL}
    apiKey: {api-key}
    Content-Type: application/json
      {
      "MerchantID":"kyanda",
      "signature":"b916c162f49856f2bc897c43bcf62d48705bbe3f3397c075403f9f"
      }
	
    Sample Response:
  
          {
          "Account_Bal" :399930,
          "Earnings_Bal" :1586.6
	 
          }
	 


Note

For possible errors and solutions, refer to the Error section.

ii. Check Transaction Status.

This is a quick way to check whether the status of the Pending transaction.

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters:
FIELD DESCRIPTION
MerchantID The content type of the payload:
application/json
transactionRef This is the Merchant reference returned after a request has been posted on the payment and Billing platform.
signature A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields with the following order:

MerchantID+ transactionRef

The resulting string is then signed with the Key Provided upon registration.

  
    Example Request:
	
    POST /billing/v1/transaction-check HTTP/1.1
    Host:  {GatewayBaseURL}
    apiKey: {api-key}
    Content-Type: application/json
    {
   "MerchantID":"kyanda",
   "transactionRef":"kyanda-API1089772",
   "signature":"51d8864a2890e73e3254ddd84968d17583f7a1a0efb66ec8fe3138a893b0e253"
    }
	
    Sample Response:
  
      {
     "status":"200", 
     "details" : {
       "Amount": "50",
       "Phone": "0747779233",
       "Posted_Time": "05-11-2021 9:19 am",
       "Status": "Success",
       "Telco": "jtl",
       "timestamp": 16207153974638

     }

   }




iii. Telco Check.

This is a quick way to check the Telco.

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters:
FIELD DESCRIPTION
MerchantID This identifies the Merchant doing Telco Check
Prefix This is the Merchant reference returned after a request has been posted.
signature A SHA-256 signature to proof that the request is coming from the Merchant.

  
    Example:
	
    "MerchantID": "",
    "prefix": "722",
    "signature": "" //sign only the merchant ID, similar to check balance API


Note

For possible errors and solutions, refer to the Error section.

PAYMENT API

Payment Collection, Bank & Mobile Wallet Payout.


A. MOBILE WALLET PAYOUT API

This API allows you to send payments from your Payment Wallet to mobile subscribers with the following Mobile Wallet Channels available in Kenya.

  1. MPESA
  2. AIRTEL MONEY
  3. EQUITEL
Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters

FIELD DESCRIPTION
MerchantID The content type of the payload: application/json
initiatorName The First and Last Name of the Initiator in one string. ie. John Doe
initiatorCountry The country the initiator is currently based in. ie. Germany
destinationPhone Phone Number of the Recipient beginning with 07. Must be 10 Digits. Eg 0715330000
amount Amount that the recipient is expected to receive. ie 1500
channel The channel the payment will be made from. It can either be the following: MPESA, AIRTEL, EQUITEL
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+phone+InitiatorName+InitiatorCountry+channel+MerchantID

Example Concatenated String:

15000715330000John DoeGermanyMPESAkyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

9447d0ea436cdddd756132c46136a1ecf6d511263669014c212b9db6f57d79b6


		
   Example Request:

   POST /billing/v3/mobile-payout/create HTTP/1.1
   Host:  {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
      {
      "MerchantID":"kyanda",
      "source":
      {
	
       "initiatorName":"John Doe",
       "initiatorCountry": "Germany"
   },

   "destination":
     {
         "destinationPhone":"0715330000",
         "amount": "1500",
         "channel":"MPESA"
     },

         "signature":"9447d0ea436cdddd75614c212b9db6f57d79b6" 

   }

   Sample Response

     {
          "status": "Pending", 
          "status_code": "200", 
          "merchant_reference": "KYAAPI677833", 
          "transactiontxt": "Request accepted for processing!" 
   }


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL


B. BANK PAYOUT API

This API allows transfer of funds from your Payment wallet to Bank accounts within Kenya.

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters
FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
initiatorName The First and Last Name of the Initiator in one string. ie John Doe
initiatorCountry The country the initiator is currently based in. ie. Germany
name The First and Last Name of the associated with the Bank Account in one string. eg Harry Kessy
accountNumber Bank Account Number. eg 2042581154
phoneNumber Phone Number of the Recipient beginning with 07. Must be 10 Digits. Eg 0715330000
amount Amount that the recipient is expected to receive. ie 1500
bankCode 3-Digit code for the Bank, well listed in the Bank Codes Section below. eg 101
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+accountNumber+phoneNumber+bankCode+InitiatorName+InitiatorCountry+MerchantID

Example Concatenated String:

150020425811540715330000101John DoeGermanykyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

9447d0ea436cdddd756132c46136a1ecf6d511263669014c212b9db6f57d79b6

Bank Codes

Bank Name Kyanda Code
Absa Bank 101
Co-operative Bank 102
Equity Bank(K) 103
Family Bank 104
KCB Bank Kenya (K) 105
Standard Chartered Bank (K) 106
ABC Bank 107
I & M Bank (K) 108
HF Group 109
Ecobank (K) 110
Habib Bank A.G. Zurich 111
NCBA Bank(K) 112
Stanbic Bank 113
Sidian Bank 114
Rafiki Microfinance Bank 115
Spire Bank 116
First Community Bank 117
Access Bank (K) 118
Diamond Trust Bank (K) 119
DIB Kenya Bank 120
Development Bank 121
Citibank N.A. 122
Bank of Baroda (K) 123
Bank of Africa (K) 124
Faulu Micro-Finance Bank 125
Credit Bank 126
Choice Microfinance Bank 127
Consolidated Bank 128
Caritas Microfinance Bank 129
Kenya Women Microfinance Bank 130
Mayfair Bank 131
Kingdom Bank 132
National Bank of Kenya 133
Middle East Bank (K) 134
Paramount Universal Bank 135
Prime Bank 136
Postbank 137
SBM Bank (K) 138
Victoria Commercial bank 139
UBA Kenya Bank 140
Salaam Microfinance Bank 141
M Oriental Bank (K) 142
Gulf African Bank 143
Guaranty Trust Bank (K) 144
Guardian Bank 145
Bank of India(K) 146

   Example Request:

   POST /billing/v3/bank-payout/create HTTP/1.1
   Host:  {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
   {
   "MerchantID":"kyanda",

   "source":
    {
	
      "initiatorName":"John Doe",
      "initiatorCountry": "Germany"
   	
   },

   "destination":
    {
      "name":"Harry Kessy",
      "accountNumber":"2042581154",
      "phoneNumber":"0715330000",
      "amount": "1500",
      "bankCode":"101"
   },

      "signature":"d1c574dfa94e43f77f6d0c18d48c809466a8fde21fa6886ba2480d4952871d8f" 

   }

   Sample Response

     {
      "status": "Pending", 
      "status_code": "200", 
      "merchant_reference": "KYAAPI677833", 
      "transactiontxt": "Request accepted for processing!" 

   }


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL


C. PAYMENT COLLECTION API
i. Mobile Checkout

Mobile checkout API allows you to initiate a Consumer to Business transaction on a Mobile subscriber’s device. Once initiated, the Subscriber will only need to authorize the payment.

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters
FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
phoneNumber Phone Number of the Recipient beginning with 07. Must be 10 Digits. Eg 0715330000
amount Amount that the recipient is expected to receive. ie 1500
channel The channel the payment will be made from. It can either be the following: MPESA, AIRTEL, EQUITEL
metadata A map of any metadata you would like us to associate with the request. You can use this field to pass Account details, Payment reasons, or any other details that will assist to process the payment. -It will be included in the Instant Payment Notification once the subscriber completes the mobile checkout request.
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+phoneNumber+channel+MerchantID

Example Concatenated String:

15000715330000MPESAkyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

9447d0ea436cdddd756132c46136a1ecf6d511263669014c212b9db6f57d79b6



   Example Request:

   POST /billing/v1/checkout/create HTTP/1.1
   Host:  {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
    {
       "MerchantID":"kyanda",
       "phoneNumber":"0715330000",
       "amount": "1500",
       "channel": "MPESA",
       "metadata":{
       "abc":"balloon",
    },
   
       "signature":"092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428"
    }

   Sample Response

   {
        "status": "Pending",
        "status_code": "200",
        "merchant_reference": "KYAAPI677833",
        "transactiontxt": "Request accepted for processing!"
   }
	
	


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL


UTILITY API

Vend Utility services through your Platform.

A. AIRTIME API

This API allows the disbursement of Pinless Airtime from your Payment Wallet to Mobile subscribers with the following networks.

  1. SAFARICOM
  2. AIRTEL
  3. TELKOM
  4. EQUITEL
  5. FAIBA
  6. FAIBA BUNDLES
Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters

FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
phone Phone Number of the Recipient beginning with 07. Must be 10 Digits. Eg 0715330000
amount Amount that the recipient is expected to receive. ie 1500
telco The channel the payment will be made from. It can either be the following: SAFARICOM, AIRTEL, EQUITEL, TELKOM, FAIBA, FAIBA_B
initiatorPhone This is the initiator’s Phone number attached along the transaction for record purposes.
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+phone+telco+initiatorPhone+MerchantID

Example Concatenated String:

15000715330000SAFARICOM0715330000kyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428



   Example Request:

   POST /billing/v1/airtime/create HTTP/1.1
   Host:  {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
     {
       "MerchantID":"kyanda",
       "phoneNumber":"0715330000",
       "amount": "1500",
       "telco": "SAFARICOM",
       "initiatorPhone": "0715330000",
        "signature":"092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428"
   }


   Sample Response

   {
       "status": "Success",
       "status_code": "0000",
       "merchant_reference": "KYAAPI677833",
       "transactiontxt": "Your request has been posted successfully!"
   }
	
	


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL


BUNDLES AMOUNT
Daily DataBundle 1GB Ksh.50
Weekly DataBundle 8GB Ksh.300
Weekly DataBundle 15GB Ksh.500
Monthly DataBundle 25GB Ksh.1000
Monthly DataBundle 40GB Ksh.2000
Monthly DataBundle 70GB Ksh.3000

B. PAY BILL API

This API allows supports the following Service Providers:

  1. Kenya Power (Both Prepaid and Postpaid)
  2. Tv Subscriptions (DSTV, GOTV, ZUKU, STARTIMES)
  3. Water Service.
Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters
FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
account Account Number. Eg 0123456789
amount Amount that the recipient is expected to receive. ie 1500
telco The destination telco. The channels codes are attached below.
initiatorPhone This is the initiator’s Phone number attached along the transaction for record purposes.
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+account+telco+initiatorPhone+MerchantID

Example Concatenated String:

1500012345678DSTV0715330000kyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428



   Example Request:

   POST /billing/v1/bill/create HTTP/1.1
   Host:  {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
    {
        "MerchantID":"kyanda",
        "phoneNumber":"0715330000",
        "amount": "1500",
        "telco": "DSTV",
        "initiatorPhone": "0715330000",
        "signature":"092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428"
   }


   Sample Response

   {
        "status": "Success",
        "status_code": "0000",
        "transactionId": "KYAAPI677833",
        "transactiontxt": "Your request has been posted successfully!"
   }
	
	


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL

DESTINATION CHANNEL CODES

TELCO CHANNEL CODE
Tv Subscription GOTV | DSTV | ZUKU | STARTIMES
Water Service NAIROBI_WTR

C. VOUCHER/PIN AIRTIME API

This API allows the disbursement of Pin/voucher Airtime from your Payment Wallet to Mobile subscribers with the following networks.

  1. SAFARICOM
  2. AIRTEL
  3. TELKOM
Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

Body Parameters
FIELD DESCRIPTION
MerchantID This identifies the Merchant making use of the Payment and Billing platform.
phone Phone Number of the Recipient beginning with 07. Must be 10 Digits. Eg 0715330000
amount Amount that the recipient is expected to receive. ie 1500
telco The destination telco. It can either be the following:SAFARICOM, AIRTEL, TELKOM
initiatorPhone This is the initiator’s Phone number attached along the transaction for record purposes.
signature

A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields. In this case, use the following order:

amount+phone+telco+initiatorPhone+MerchantID

Example Concatenated String:

15000715330000SAFARICOM0715330000kyanda


The resulting string is then signed with the Security Key provided/generated upon registration.

Sample Signature generated from the above Concatenated String:

092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428



   Example Request:

   POST /billing/v1/pin-airtime/create HTTP/1.1
   Host: : {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
    {
      "MerchantID":"kyanda",
      "phone":"0715330000",
      "amount": "1500",
      "telco": "SAFARICOM",
      "initiatorPhone": "0715330000",
      "signature":"092f758dec7149cc4c4cd09e2122d10016d0e2f8e2aed5d0b8a0615982ed1428"
   }


   Sample Response Success

   {
      "status": "Success",
       "status_code": "0000",
       "transactionId": "KYAAPI677833",
       "transactiontxt": "Your request has been posted successfully!"
   }
	
	


Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL

INSTANT PAYMENT NOTIFICATION

A notification is information sent to your application whenever we need to let you know that something/change has occurred. For instance, when a payment has been initiated, the request is pending. Once the payment is fully executed, we immediately send you the details of the transaction as POST variables to the callback URL you set on your Application for a given product.

The Callback URL can be registered in two ways:

  1. Through API settings on the Kyanda Merchant Dashboard.
  2. Through the API endpoint.

Note

Once the endpoint is registered, no further changes can be made using this endpoint. In case one needs the callback changed, engage our Support team for assistance.

Callback URL Registration.

This request enables the registration of the Callback URL

Request Parameters

In addition to the Standard request headers, the body of the request should contain the following fields:

DESTINATION CHANNEL CODES

FIELD DESCRIPTION
MerchantID In addition to the Standard request headers, the body of the request should contain the following fields:
callbackURL HTTPS callback URL
signature A SHA-256 signature to proof that the request is coming from the Merchant. Build a string of concatenated values of the request fields with the following order: MerchantID The resulting string is then signed with the Key Provided upon registration.


   Example Request:

   POST /billing/v1/callback-url/create HTTP/1.1
   Host: : {GatewayBaseURL}
   apiKey: {api-key}
   Content-Type: application/json
     {
       "MerchantID":"kyanda",
       “callbackURL”:”https://website.com/callback”,
       "signature":"d1c574dfa94e43f77f6d0c18d48c809466a8fde21fa6886ba2480d4952871d8f"
   }


   Sample Response

   {
        "status": "Success",
        "status_code": "0000",
        "transactionId": "KYAAPI677833",
        "transactiontxt": "Callback Updated!"
   }
	
	


Sample Instant Payment Notification.(IPN)



     {
       “category”: ”UtilityPayment”,
       “source”: “PaymentWallet”,
       “destination”: “0715330000”,
       “MerchantID”: “kyanda”,
       “details”: { biller_receiptNo: 0105781244210},
       “status”: “Success”,
       “status_code”:”0000”,
       “message”:”Your Request has been processed successfully.”,
       “transactionDate”: “20210401091002”,
       “transactionRef”: “KYAAPI677833,
       “amount”: “1500”
   }


   
	
	


Sample Instant Payment Notification.(IPN)

Note

For possible errors and solutions, refer to the Error section.

Once the request has been posted, we shall send an IPN/Callback to the registered URL

Once you receive the IPN, you will be expected to send back a JSON response that confirms that you have received the IPN. Ensure to respond with status 200 and the below JSON body.

{

“status”:success”

}


APPENDIX

Errors and Possible solutions

Standard Errors across the platform.

CODE DESCRIPTION
0000 Request processed sucessfully.
1100 Transaction created and pending processing.
1101 Invalid Merchant ID.
1102 Authentication failed.
1103 Forbidden access
1104 Signature Mismatch.
1105 Payment services unavailable.
1106 Airtime Service unavailable.
1107 Insufficient float balance.
1108 Missing parameter.
1109 Parameter validation error.
1201 Invalid Bank Code
5000 Unexpected error has occurred.
6001 Cannot register the URL
6002 Invalid URL format.
7001 Transaction not found.
8001 Invalid account number format.
8002 Invalid phone number format.
8003 Invalid Telco.
8004 Invalid amount format.
8005 Amount limit exceeded.
8006 Duplicate transmission.
9001 Invalid phone number format.
9002 Invalid transaction channel.
9003 Invalid amount format.
9004 Amount limit exceeded.
9005 Duplicate transmission