node-qiwi-api
Official documentation for Qiwi api.
Get started
Firstly, get access token at Qiwi.
npm install node-qiwi-api
You can use callback and promise based api.
Initialise new wallet instance with your access token:
var callbackQiwi = require('node-qiwi-api').callbackApi;
var asyncQiwi = require('node-qiwi-api').asyncApi;
var callbackWallet = new callbackQiwi(token);
var asyncWallet = new asyncQiwi(token);
Now you can get information about your wallet and make money transfers.
Identification data
wallet.getIdentificationData(wallet, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
Identify wallet
wallet.identifyWallet(wallet, requestOptions, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions includes:
- birthDate - Date of birth (YYYY-MM-DD)
- firstName - First name
- middleName - Middle name
- lastName - Last name
- passport - Serial and number of passport
- snils - SNILS number
- inn - INN number
- oms - OMS number
Information about account
wallet.getAccountInfo((err, data) => {
if(err) {
}
console.log(data);
})
Get accounts
wallet.getAccounts(wallet, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
Get possible account aliases
Return possible for creation at your wallet account aliases
wallet.getPossibleAccountAliases(wallet, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
Create account
Create account in new currency
wallet.createAccount(wallet, accountAlias, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
accountAlias - Account alias, possible values: qw_wallet_rub, qw_wallet_kzt, qw_wallet_usd, qw_wallet_eur
If call was successfull as data you will have { success: true }, else { success: false }
Set default account
Set default account for all operations
wallet.setDefaultAccount(wallet, accountAlias, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
accountAlias - Account alias, possible values: qw_wallet_rub, qw_wallet_kzt, qw_wallet_usd, qw_wallet_eur
If call was successfull as data you will have { success: true }, else { success: false }
Operation history
wallet.getOperationHistory(wallet, requestOptions, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions includes:
- rows - Amount of payments in response. Integer from 1 to 50. Required.
- operation - Operation type. ALL - all operations, IN - incoming only, OUT - outgoing only, QIWI_CARD - just payments by QIWI cards (QVC, QVP). Default - ALL
- sources - Payment source. Array of values. Allowable values: QW_RUB - ruble account of wallet, QW_USD - usd account of wallet, QW_EUR - euro account of wallet, CARD - added and not added to wallet cards, MK - account of mobile operator. If not presented, you will receive info from all sources
- startDate - Start date (YYYY-MM-ddThh:mm:ssZ). By default equals yesterday date. Use only with endDate
- endDate - End date (YYYY-MM-ddThh:mm:ssZ). By default equals current date. Use only with startDate
- nextTxnDate - Transaction date (YYYY-MM-ddThh:mm:ssZ), (see nextTxnDate in response). Use only with nextTxnId
- nextTxnId - Previous transaction number (see nextTxnId in response). Use only with nextTxnDate
Maximum interval between startDate and endDate - 90 days.
As example - information about 25 outgoing payments can be get by next way:
wallet.getOperationHistory({rows: 25, operation: "OUT"}, (err, operations) => {
})
Operations statistics
If you want to see statistics for summs of payments by period of time use this method. Example:
wallet.getOperationStatistics(wallet, requestOptions, (err, data) => {
if(err) {
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions: operation, sources, startDate, endDate - Parameters are similar to getOperationHistory.
Get transaction info
Example:
wallet.getTransactionInfo(transactionId, (err, data) => {
if(err) {
}
console.log(data);
})
Get transaction receipt
Example:
wallet.getReceipt(transactionId, requestOptions, (err, data) => {
if(err) {
}
console.log(data);
})
requestOptions includes:
- type - Transaction type from getOperationHistory
- format - File format, see wallet.receiptFormat
Transfer to Qiwi wallet
wallet.toWallet({ amount: '0.01', comment: 'test', account: '+79261234567' }, (err, data) => {
if(err) {
}
console.log(data);
})
- amount - Ammount of money
- comment - Commentary for payment.
- account - Receiver phone number (with international prefix)
Transfer to mobile phone
Similar to "transfer to qiwi wallet", but number without international prefix:
wallet.toMobilePhone({ amount: '0.01', comment: 'test', account: '9261234567' }, (err, data) => {
if(err) {
}
console.log(data);
})
Transfer to card
Similar to other transfers, but account is card number:
wallet.toCard({ amount: '0.01', comment: 'test', account: '5213********0000' }, (err, data) => {
if(err) {
}
console.log(data);
})
Transfer to bank account
wallet.toBank({ amount: '0.01', account: '5213********0000', account_type: '1', exp_date: 'MMYY' }, recipient, (err, data) => {
if(err) {
}
console.log(data);
})
- ammount - Ammount of money
- account - Receiver card/account number
- account_type - Type of bank identificator.
- for Alfa-bank (Альфа-Банк) - 1
- for OTP Bank (АО ОТП БАНК) - 1
- for Rosselhozbank (АО РОССЕЛЬХОЗБАНК) - 5
- for Russian Standard (Русский Стандарт) - 1
- for VTB (ВТБ ПАО) - 5
- for Promsvyazbank (Промсвязьбанк) - 7
- for Sberbank (ПАО Сбербанк) - 5
- for Renessans Credit (Ренессанс Кредит) - 1
- for Moscow Credit Bank (ПАО Московский кредитный банк) - 5
- exp_date - Card expiration date (MMYY), в формате ММГГ (as examlpe: 0218 - february 2018). Only for card transfer.
- recipient -
- 464 - Alfa-bank (Альфа-Банка)
- 466 - Tinkoff Bank (Тинькофф Банк)
- 804 - OTP Bank (АО ОТП БАНК)
- 810 - Rosselhozbank (АО РОССЕЛЬХОЗБАНК)
- 815 - Russian Standard (Русский Стандарт)
- 816 - VTB (ВТБ ПАО)
- 821 - Promsvyazbank (Промсвязьбанк)
- 870 - Sberbank (ПАО Сбербанк)
- 881 - Renessans Credit (Ренессанс Кредит)
- 1135 - Moscow Credit Bank (ПАО Московский кредитный банк)
Check commission rates
wallet.checkOnlineCommission(recipient, requestOptions, (err, data) => {
if(err) {
}
console.log(data);
})
recipient - Allowable values stored in wallet.recipients
requestOptions includes:
- account - Phone number with international prefix or card/account number, as example 79991234567
- amount - Amount of money for calculate commission
Check operation commission
wallet.checkCommission(recipient, (err, data) => {
if(err) {
}
console.log(data);
})
data.content.terms.commission.ranges[i]:
- recipient - Allowable values stored in wallet.recipients
Response contains:
- bound - Payment amount, starting from which the condition applies
- rate - Commission (absolute multiplier)
- fixed - Fixed amount of commission