Official documentation for Qiwi api.
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.
Next examples presented for callback api.
wallet.getIdentificationData(wallet, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
wallet.identifyWallet(wallet, requestOptions, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions includes:
wallet.getAccountInfo((err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet.getAccounts(wallet, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
Return possible for creation at your wallet account aliases
wallet.getPossibleAccountAliases(wallet, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
Create account in new currency
wallet.createAccount(wallet, accountAlias, (err, data) => {
if(err) {
/*hanle error*/
}
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 for all operations
wallet.setDefaultAccount(wallet, accountAlias, (err, data) => {
if(err) {
/*hanle error*/
}
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 }
wallet.getOperationHistory(wallet, requestOptions, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions includes:
As example - information about 25 outgoing payments can be get by next way:
wallet.getOperationHistory({rows: 25, operation: "OUT"}, (err, operations) => {
/* some code */
})
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) {
/*hanle error*/
}
console.log(data);
})
wallet - wallet number without plus (+) and with prefix (79991234567)
requestOptions: operation, sources, startDate, endDate - Parameters are similar to getOperationHistory.
Example:
wallet.getTransactionInfo(transactionId, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
Example:
wallet.getReceipt(transactionId, requestOptions, (err, data) => {
if(err) {
/*hanle error*/
}
console.log(data);
})
requestOptions includes:
wallet.toWallet({ amount: '0.01', comment: 'test', account: '+79261234567' }, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
Similar to "transfer to qiwi wallet", but number without international prefix:
wallet.toMobilePhone({ amount: '0.01', comment: 'test', account: '9261234567' }, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
Similar to other transfers, but account is card number:
wallet.toCard({ amount: '0.01', comment: 'test', account: '5213********0000' }, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
wallet.toBank({ amount: '0.01', account: '5213********0000', account_type: '1', exp_date: 'MMYY' }, recipient, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
wallet.getCrossRates((err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
wallet.toCard(requestOptions, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
requestOptions includes:
wallet.convertCurrency({amount: 10, currency: wallet.currencyCode.KZT, account:'+79991234567'}, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
requestOptions includes:
wallet.getInvoices(requestOptions, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
requestOptions includes:
wallet.payInvoice(invoiceId, currency, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
wallet.cancelInvoice(invoiceId, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
wallet.checkOnlineCommission(recipient, requestOptions, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
recipient - Allowable values stored in wallet.recipients
requestOptions includes:
wallet.checkCommission(recipient, (err, data) => {
if(err) {
/* handle err*/
}
console.log(data);
})
data.content.terms.commission.ranges[i]:
Response contains: