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

ACCOUNT API

Manage your API account

AUTHENTICATION AND AUTHORIZATION

Standard Request Headers

The standard request headers needed when authenticating with the API:


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 he content type of the payload: application/json
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/account-balance HTTP/1.1
    Host: : {GatewayBaseURL}
    apiKey: {api-key}
    Content-Type: application/json
    {
		"MerchantID":"kyanda",
		"transactionRef":"kyanda-API1089772",
		"signature":"51d8864a2890e73e3254ddd84968d17583f7a1a0efb66ec8fe3138a893b0e253"
    }
	
    Sample Response:
  
    {
   "status":"200", 
   "details" : {
    “category”: ”BankPayout”,
    “source”: “PaymentWallet”,
    “destination”: “2042581154”,
    “MerchantID”: “kyanda”,
    “details”: {},
    “requestMetadata”: {},
    “status”: “Success”,
    “status”: “Success”,
    “transactionFee”: “50”,
    “amount”: “1500”

     },

    }



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/v1/account-balance 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.


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+Initiator Country+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/v1/account-balance 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.


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: 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/v1/account-balance HTTP/1.1
Host: : {GatewayBaseURL}
apiKey: {api-key}
Content-Type: application/json
	{
"MerchantID":"kyanda",
"phoneNumber":"0715330000",
"amount": "1500",
"channel": "MPESA",
"metadata":
"abc":"balloon",
	},
"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.


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.
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
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/account-balance 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.


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: 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/account-balance 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.

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/account-balance HTTP/1.1
Host: : {GatewayBaseURL}
apiKey: {api-key}
Content-Type: application/json
	{
"MerchantID":"kyanda",
"phone":"0715330000",
"amount": "1500",
"telco": "DSTV",
"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

DESTINATION CHANNEL CODES

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

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:

Body Parameters

DESTINATION CHANNEL CODES

TELCO CHANNEL CODE
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/account-balance 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)

Note

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

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.
5000 Unexpected error has occurred.

Airtime Service errors.

CODE DESCRIPTION
9001 Invalid phone number format.
9002 Invalid transaction channel.
9003 Invalid amount format.
9004 Amount limit exceeded.
9005 Duplicate transmission

Pay Bill Errors

CODE DESCRIPTION
8001 Invalid account number format.
8002 Invalid phone number format.
8003 Invalid Telco.
8004 Invalid amount format.
8005 Amount limit exceeded.
8006 Duplicate transmission.

Callback Registration API errors

CODE DESCRIPTION
6001 Cannot register the URL
6002 Invalid URL format.

Account: Check Transaction.

CODE DESCRIPTION
7001 Transaction not found.