node-qiwi
v1.0.7
Published
API for Qiwi Wallet.
Downloads
21
Readme
node-qiwi
API for Qiwi Wallet.
Install
$ npm i node-qiwi -S
Tests
$ npm test
Docs
- constructor(key)
- .getProfile(settings) ⇒
[Promise]
- .getBalance() ⇒
[Promise]
- .getHistory(contractId, settings) ⇒
[Promise]
- .getIdentification(contractId, body) ⇒
[Promise]
- .getTransactionsStats(contractId, settings) ⇒
[Promise]
- .getTransaction(transactionId, settings) ⇒
[Promise]
- .sendPayment(amount, account, comment) ⇒
[Promise]
constructor(key)
| Parameter | Type | Requried | Description | |:-----------:|:---------:|:---------:|:------------:| | key | string | yes | Access token for call API methods |
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) |
const profile = await wallet.getProfile()
Get profile.
.getBalance()
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) |
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 |
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 |
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 |
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 |
const payment = await wallet.sendPayment(1, 37253676697, 'This is comment')
Send payment.
License
MIT.