Javascript Sdk for KKIAPAY (https://kkiapay.me) API
- MTN Mobile Money Debit & Transfer Request
- Flooz Mobile Money Debit Request
- Ecobank Express Cash
- Visa card payments
- Master card payments
Using npm:
$ npm i -s kkiapay
Using cdn:
<script src="https://unpkg.com/kkiapay/dist/kkiapay.bundle.js"></script>
// setup your api key (https://www.kkiapay.me)
//initialize kkiapay in production environnment
const k = kkiapay("<your-api-key>")
//initialize kkiapay in sandbox environnment
const k = kkiapay("<your-api-key>",{sandbox:true})
Performing a Debit
request
//request 100 XOF from 67 43 42 70, mobile money account
k.debit("22967434270",100).then((res) => {
// handle response
}).catch((err) => {
//handle error
})
.debit() Details
Argument | Type | Required | Details |
phone | String | Yes | Valid mobile money number to debit. ex : 22967434270 |
amount | Numeric | Yes | Amount to debit from user account (XOF) |
firstname | String | No | Client firstname |
lastname | String | No | Client lastname |
String | No | Client email address | |
callback | String | No | In case of successful payment the payment information is sent by POST on this link |
Server responds in 3 cases :
- user completes payment with success ( then block )
- user rejected the approval request ( catch block)
- user cancels the request for approval ( catch block )
- timeout - 90s (catch block )
- system error ( catch block )
Attribute | Type | When | Details |
---|---|---|---|
failureCode | ((string)) | Failed |
The status of requested payment processing_error System is busy or user already has a pending payment requestinsufficent_fund User account balance is less than requested amount |
failureMessage | ((string)) | Failed |
Description of error |
account | ((string)) | Failed / Success |
User phone number |
transactionId | ((string)) | Failed / Success |
Unique Transaction's identifier |