# node-qiwi

> API for Qiwi Wallet.

Latest version **1.0.7** (published 2017-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-qiwi
pnpm add node-qiwi
yarn add node-qiwi
bun add node-qiwi
```

## 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.7 |
| Published | 2017-12-21 |
| First published | 2017-11-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Mikhail Semin |
| Maintainers | bifot |
| Keywords | qiwi, wallet, money, api |

## Links

- npm: https://www.npmjs.com/package/node-qiwi
- Repository: https://github.com/bifot/node-qiwi
- Homepage: https://github.com/bifot/node-qiwi#readme
- Issues: https://github.com/bifot/node-qiwi/issues
- npm.io page: https://npm.io/package/node-qiwi

## Dependencies (2)

- [request](https://npm.io/package/request.md) ^2.83.0
- [request-promise](https://npm.io/package/request-promise.md) ^4.2.2

## Recent versions

- 1.0.7 (latest) — 2017-12-21
- 1.0.6 — 2017-12-21
- 1.0.5 — 2017-12-21
- 1.0.4 — 2017-11-12
- 1.0.3 — 2017-11-06
- 1.0.2 — 2017-11-05
- 1.0.1 — 2017-11-05
- 1.0.0 — 2017-11-05

## README

[![node-qiwi](https://img.shields.io/npm/v/node-qiwi.svg?style=flat-square)](https://www.npmjs.com/package/node-qiwi/)
[![node-qiwi](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)

# node-qiwi

API for Qiwi Wallet.

## Install

```sh
$ npm i node-qiwi -S
```

## Tests

```sh
$ npm test
```

## Docs

* [constructor(key)](#constructorkey)
* [.getProfile(settings)](#getprofilesettings) ⇒ `[Promise]`
* [.getBalance()](#getbalance) ⇒ `[Promise]`
* [.getHistory(contractId, settings)](#gethistorycontractid-settings) ⇒ `[Promise]`
* [.getIdentification(contractId, body)](#getidentificationcontractid-body) ⇒ `[Promise]`
* [.getTransactionsStats(contractId, settings)](#gettransactionsstatscontractid-settings) ⇒ `[Promise]`
* [.getTransaction(transactionId, settings)](#gettransaction-transactionid-settings) ⇒ `[Promise]`
* [.sendPayment(amount, account, comment)](#sendpaymentamount-account-comment) ⇒ `[Promise]`

### constructor(key)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| key        | string    | yes       | Access token for call API methods |

```js
const Qiwi = require('node-qiwi')

const wallet = new Qiwi(process.env.TOKEN)
```

Create wallet.

### .getProfile(settings)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| settings   | object    | no        | Extra settings ([see](https://developer.qiwi.com/ru/qiwi-wallet-personal/#profile)) |

```js
const profile = await wallet.getProfile()
```

Get profile.

### .getBalance()

```js
const balance = await wallet.getBalance()
```

Get balance.

### .getHistory(contractId, settings)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| contractId | string    | yes       | Wallet's contractId |
| settings   | object    | no        | Extra settings ([see](https://developer.qiwi.com/ru/qiwi-wallet-personal/#payments_history)) |

```js
const history = await wallet.getHistory(contractId)
```

Get history.

### .getIdentification(contractId, body)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| contractId | string    | yes       | Wallet's contractId |
| body       | object    | yes       | Identification's data |

```js
const identification = await wallet.getIdentification(contractId, {
  firstName: 'Иван',
  lastName: 'Иванов',
  middleName: 'Иванович',
  birthDate: '1998-02-11',
  passport: 4400111222
})
```

Get identification.

### .getTransactionsStats(contractId, settings)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| contractId | string    | yes       | Wallet's contractId |
| settings   | object    | yes       | Extra settings |
| settings.startDate | date    | yes       | Start date |
| settings.endDate | date    | yes       | End date |

```js
const stats = await wallet.getTransactionsStats(contractId, {
  startDate,
  endDate
})
```

Get transaction stats.

### .getTransaction(transactionId, settings)

| Parameter  | Type      | Requried  | Description  |
|:-----------:|:---------:|:---------:|:------------:|
| transactionId | string    | yes       | Wallet's contractId |
| settings   | object    | yes        | Extra settings |
| settings.type   | string    | yes        | Transaction's type |

```js
const transaction = await wallet.getTransaction(transactionId, { type })
```

Get transaction.

### .sendPayment(amount, account, comment)

| Parameter  | Type          | Requried  | Description  |
|:-----------:|:-------------:|:---------:|:------------:|
| amount     | number/string | yes       | Transaction amount     |
| account    | number/string | yes       | Recipient's account    |
| comment    | string        | no        | Comment to transaction |

```js
const payment = await wallet.sendPayment(1, 37253676697, 'This is comment')
```

Send payment.

## License

MIT.

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