# kkiapay-nodejs-sdk

> ## Installing

Latest version **1.0.0** (published 2020-11-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install kkiapay-nodejs-sdk
pnpm add kkiapay-nodejs-sdk
yarn add kkiapay-nodejs-sdk
bun add kkiapay-nodejs-sdk
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-11-22 |
| First published | 2020-11-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 26.4 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | geecko |

## Links

- npm: https://www.npmjs.com/package/kkiapay-nodejs-sdk
- npm.io page: https://npm.io/package/kkiapay-nodejs-sdk

## Dependencies (10)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [dotenv](https://npm.io/package/dotenv.md) ^8.0.0
- [loadash](https://npm.io/package/loadash.md) ^1.0.0
- [webpack](https://npm.io/package/webpack.md) ^4.29.6
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.26.0
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.3.4
- [webpack-cli](https://npm.io/package/webpack-cli.md) ^3.2.3
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.26.0
- [babel-preset-env](https://npm.io/package/babel-preset-env.md) ^1.7.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) ^1.2.3

## Recent versions

- 1.0.0 (latest) — 2020-11-22

## README

# KKIAPAY NODEJS-SDK

## Installing

  

Using npm:
```bash
    $ npm i -s kkiapay/nodejs-sdk
```

## Initialization

#### Production
```js
// setup your api key (https://www.kkiapay.me)
//initialize kkiapay in production environnment
const k = kkiapay({privatekey:"xxxxxxx",publickey:"xxxxxxx",secretkey:"xxxxxxx"})
```

#### Sandbox
```js
//initialize kkiapay in sandbox environnment
const k = kkiapay({privatekey:"xxxxxxx",publickey:"xxxxxxx",secretkey:"xxxxxxx",sandbox:true})
```

  

## Request to retrieve transactions 

#### EXAMPLE
```js
// Request to retrieve transactions
k.verify("transactionId").
then((response) => {
    //handle response
}).
catch((error) => {
    //handle error
})
```

## Request to revert transaction 

#### EXAMPLE

```js
// Request to retrieve transactions
k.refund("transactionId").
then((response) => {
    //handle response
}).
catch((error) => {
    //handle error
})
```

## Request to schedule payout 

#### EXAMPLE

```js
// Example to schedule payout when amount reaches a ceiling
k.setup_payout({algorithm : "roof", send_notification : true, destination_type : "MOBILE_MONEY", roof_amount : "1000", destination : "22997000000" }).
then((response) => {
    //handle response
}).
catch((error) => {
    //handle error
})

// Example to schedule payout by frequency
k.setup_payout({algorithm : "rate", send_notification : true, destination_type : "MOBILE_MONEY", rate_frequency : "1m", destination : "22997000000" }).
then((response) => {
    //handle response
}).
catch((error) => {
    //handle error
})
```

| PARAMETERS      | DESCRIPTION             |
| ----------- | ----------------------- |
| algorithm    | (String)   "roof" if the amount reaches a ceiling or "rate" for refund by frequency. |
| send_nofitication      | (Boolean) to receive a notification after payment.                   |
| destination_type    | (String) "BANK_ACCOUNT" or "MOBILE_MONEY"              |
| destination |  (String) the bank number or phone number of the receiver of the refund |
| rate_frequency | (String) "1m", "1w", "3j" Refund frequency when choosing "rate" algorithm  |
| roof_amount | (String) Refund amount when choosing "roof" algorithm  |


## COMPLETE  POSSIBLE STATUS LIST

| STATUS      | DESCRIPTION             |
| ----------- | ----------------------- |
|  SUCCESS    |        Successful transaction                 |
| FAILED      |         Transaction failed                |
| INSUFFICIENT_FUND    | Not enough money in developper  account              |
| TRANSACTION_NOT_ELIGIBLE | This transaction  are already reverted or are not eligible                    |
| TRANSACTION_NOT_FOUND |  Transaction not found |
| INVALID_TRANSACTION | You are not owner of this transaction  |
| INVALID_TRANSACTION_TYPE | We can't revert this transaction  |
| INVALID_PAYOUT_DESTINATION_ACCOUNT | Provided destination account is not valid mobile money account |

---
_Source: https://npm.io/package/kkiapay-nodejs-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
