@darkwolf/qiwi.cjs
v1.0.1
Published
QIWI API
Downloads
8
Readme
QIWI API
Install
ECMAScript (Node.js v12.x LTS or higher)
npm i --save @darkwolf/qiwi.mjs
CommonJS (Node.js v10.x LTS or higher)
npm i --save @darkwolf/qiwi.cjs
Lazy Loading CommonJS (Node.js v10.x LTS or higher)
npm i --save @darkwolf/qiwi.lazy.cjs
Using
// ECMAScript
import QIWI from '@darkwolf/qiwi.mjs'
// CommonJS
const QIWI = require('@darkwolf/qiwi.cjs')
// Lazy Loading CommonJS
const QIWI = require('@darkwolf/qiwi.lazy.cjs')
const qiwi = new QIWI(token, {
phoneNumber // Some requests require a wallet phone number
})
// Handling events
qiwi.on('request', request => {})
qiwi.on('response', response => {})
qiwi.on('error', error => {})
// Getting account balance
const {balance} = await qiwi.getAccount('qw_wallet_rub')
// Getting payments
const timestamp = new UnixTimestamp()
const {transactions} = await qiwi.getPayments({
type: 'incoming',
sources: ['qw_rub'],
startDate: timestamp.clone().subtract('90 days'),
endDate: timestamp,
limit: 50
})
// Sending payments
const paymentRequest = await qiwi.transferToQIWIWallet(phoneNumber, 5000, {
comment: 'Ave, Darkwolf!'
})
// Getting transactions
const transaction = await qiwi.getTransaction(transactionId)
const blob = await transaction.downloadCheque('application/pdf')
await transaction.sendChequeToEmail('[email protected]')
// Search for providers
const providers = await qiwi.searchProvider('сбер')