https://github.com/bifot/node-qiwi
API for Qiwi Wallet
https://github.com/bifot/node-qiwi
api pay payment payments qiwi wallet
Last synced: about 1 year ago
JSON representation
API for Qiwi Wallet
- Host: GitHub
- URL: https://github.com/bifot/node-qiwi
- Owner: bifot
- License: mit
- Created: 2017-11-05T14:42:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-23T17:23:39.000Z (about 8 years ago)
- Last Synced: 2025-04-12T20:48:35.562Z (about 1 year ago)
- Topics: api, pay, payment, payments, qiwi, wallet
- Language: JavaScript
- Homepage: https://npmjs.com/package/node-qiwi
- Size: 26.4 KB
- Stars: 7
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/node-qiwi/)
[](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.