Get started
Last Updated: 15-09-2022
The K-Pay API provides programmatic access to allow you to pay and get paid by your customers using MoMo by MTN, Aitel Money, Visa, Mastercard, SMartcash, SPENN etc
To use this API, you need credentials and API key. Please contact us at www.kpay.africa to get your access.
API Endpoint :
https://pay.esicia.com/
Supported Payment methods
We are ISO/IEC 27001:2013 and PCI-DSS Certified
Headers
Field | Type | Description |
---|---|---|
Kpay-Key | String | Your API key. |
Authorization | String | Basic Authentication |
Content-Type | String | Application/Json |
Payment request
To initiate a payment you need to make a POST call to the following request in Json
# Here is a curl example
curl \
-X POST https://pay.esicia.com/ \
-H 'secret_key=your_api_key' \
-d '{
"action":"pay",
"msisdn":"0783300000",
"details":"order",
"refid":"15947234071471114",
"amount":4200,"currency":"RWF",
"email":"user@user.rw",
"cname":"CUSTOMER NAME",
"cnumber":"123456789",
"pmethod":"momo",
"retailerid":"02",
"returl":"https://iduka.rw/api/call",
"redirecturl":"https://www.iduka.rw"}'
Success result example :
{
"reply":"PENDING",
"url":"https://pay.esicia.com/checkout/A12343983489",
"success":1,
"authkey":"m43snbf9oivnmersqh6mn1lbh5",
"tid":"E6974831594723691",
"refid":"15947234071471114",
"retcode":0
}
Parameters
Parameter | Severity | Type | Description |
---|---|---|---|
action | Required | string | pay |
msisdn | Required | string | The mobile phone number starting with country code and no + sign. Also referred to sometimes as MSISDN. |
Required | String | Email of the paying client | |
details | Required | string | Details of the payment to do |
refid | Required | string | Payment reference from your system (unique) |
amount | Required | integer | The amount of the payment to do (in RWF) |
currency | String | Will be RWF if not set (supported are RWF and USD in future) | |
cname | Required | string | The name of the person paying |
cnumber | Required | String | Customer number at the Payment processor Level |
pmethod | Required | string | The payment method |
retailerid | Required | String | The unique retailer ID |
returl | Required | String | Return url for postback of the asynchronous response (sometimes referred as webhook) |
redirecturl | Required | String | Redirection url after payment |
logourl | Optional | String | url to the logo image to be used on card checkout page |
Failed example :
{
"reply":"TARGET_AUTHORIZATION_ERROR",
"url":" ",
"success":0,
"authkey":"m43snbf9oivnmersqh6mn1lbh5",
"tid":"E6974831594723691",
"refid":"15947234071471114",
"retcode"::606
}
Payment status inquiry
To check a payment status, you need to make a POST call to the following request in Json
# Here is a curl example
curl \
-X POST https://pay.esicia.com/ \
-H 'secret_key=your_api_key' \
-d '{
"action":"checkstatus",
"refid":"15947234071471114"
}'
Success result example :
{
"tid":"A441489693051",
"refid":"1489693046",
"momtransactionid":"616730887",
"statusid":"01",
"statusdesc":"Successfully processed transaction."
}
Parameters
Parameter | Severity | Type | Description |
---|---|---|---|
action | Required | string | checkstatus |
refid | Required | string | Payment reference from your system (unique) |
Failed example :
{
"tid":"E6974831594723691",
"refid":"15947234071471114",
"momtransactionid":"12943154",
"statusdesc":"TARGET_AUTHORIZATION_ERROR",
"statusmsg":"Not enough funds",
"statusid":"02"
}
Payment callback response
K-Pay will send to your system a response as soon as it gets its completion status this is send to returl
parameter
# Here is a curl example
curl \
-X POST ####returl#### \
-d '{
"tid":"A441489693051",
"refid":"1489693046",
"momtransactionid":"616730887",
“payaccount”:”0783300000”,
"statusid":"01",
"statusdesc":"Successfully processed transaction."
}
'
Expected response :
{
"tid":"A441489693051",
"refid":"1489693046",
"reply":"OK"
}
Parameters
Parameter | Type | Description |
---|---|---|
tid | string | K-Pay internal payment reference number |
refid | string | Payment reference from your system (unique) |
momtransactionid | String | Transaction ID from the concerned financial institution |
statusid | string | 01: successful ; 02: Failed |
statusdesc | String | Details of transaction status |
payaccount | String | Bank account / mobile number used to pay |
Available Payment methods
Supported Payment methods in K-Pay
# | Payment Method | pmethod value |
---|---|---|
1 | MoMo by MTN | momo |
2 | Airtel Money | momo |
3 | Visa | cc |
4 | MasterCard | cc |
5 | SmartCash | cc |
6 | SPENN | spenn |
7 | Safaribus | cc |
Test Cards
Some test cards you can use on Visa / MasterCard payment methods
CVV: use 3 digits example 123
Expiration date: use any date in the future
Card | Scheme |
---|---|
4111 1111 1111 1111 | Visa |
4444 3333 2222 1111 | Visa |
4035 5010 0000 0008 | Visa |
5555 4444 3333 1111 | MasterCard |
2222 4107 4036 0010 | MasterCard |
5555 5555 5555 4444 | MasterCard |
Transaction limits
The transaction limits are set based on transaction payment method
Payment method | Limit |
---|---|
Mobile wallets | 2,000,000 RWF |
Cards | 10,000,000 RWF |
Return codes
The K-Pay API has various response codes (retcode):
Code | Meaning |
---|---|
0 | No error. Transaction being processed |
01 |
Successful payment
|
02 | Payment failed |
03 | Pending transaction |
401 | Missing authentication header |
500 | Non HTTPS request |
600 | Invalid username / password combination |
601 | Invalid remote user |
602 | Location / IP not whitelisted |
603 | Empty parameter. - missing required parameters |
604 | Unknown retailer |
605 | Retailer not enabled |
606 | Error processing |
607 | Failed mobile money transaction |
608 | Used ref id – error uniqueness |
609 | Unknown Payment method |
610 | Unknown or not enabled Financial institution |
611 | Transaction not found |