/js-sdk

Javascript Sdk for KKIAPAY API

Primary LanguageJavaScriptMIT LicenseMIT

KKIAPAY

Build Status npm version

Javascript Sdk for KKIAPAY (https://kkiapay.me) API

Features

  • MTN Mobile Money Debit & Transfer Request
  • Flooz Mobile Money Debit Request
  • Ecobank Express Cash
  • Visa card payments
  • Master card payments

Installing

Using npm:

$ npm i -s kkiapay

Using cdn:

<script src="https://unpkg.com/kkiapay/dist/kkiapay.bundle.js"></script>

Initialization

Production

// setup your api key (https://www.kkiapay.me)
//initialize kkiapay in production environnment
const k = kkiapay("<your-api-key>")

Sandbox

//initialize kkiapay in sandbox environnment
const k = kkiapay("<your-api-key>",{sandbox:true})

Mobile Money

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
})

Reference

Methods

.debit() Details

ArgumentTypeRequiredDetails
phoneStringYesValid mobile money number to debit. ex : 22967434270
amountNumericYesAmount to debit from user account (XOF)
firstnameStringNoClient firstname
lastnameStringNoClient lastname
emailStringNoClient email address
callbackStringNo In case of successful payment the payment information is sent by POST on this link

Response

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 request
  • insufficent_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