API provides methods to control balances of your QIWI wallet.
Provides current balances of your QIWI Wallet.
curl "https://edge.qiwi.com/funding-sources/v2/persons/<wallet>/accounts" \
--header "Accept: application/json" \
--header "Authorization: Bearer <API token>"
GET /funding-sources/v2/persons/<wallet>/accounts HTTP/1.1
Accept: application/json
Authorization: Bearer <API token>
Host: edge.qiwi.com
import requests
# QIWI Wallet balances
def balance(login, api_access_token):
s = requests.Session()
s.headers['Accept']= 'application/json'
s.headers['authorization'] = 'Bearer ' + api_access_token
b = s.get('https://edge.qiwi.com/funding-sources/v2/persons/' + login + '/accounts')
return b.json()
-
- personId - your wallet number (without + sign)
-
- Accept: application/json
- Authorization: Bearer ***
HTTP/1.1 200 OK
Content-Type: application/json
{
"accounts": [
{
"alias": "mc_beeline_rub",
"fsAlias": "qb_mc_beeline",
"bankAlias": "QIWI",
"title": "MC",
"type": {
"id": "MC",
"title": "Счет мобильного кошелька"
},
"hasBalance": false,
"balance": null,
"currency": 643
},
{
"alias": "qw_wallet_rub",
"fsAlias": "qb_wallet",
"bankAlias": "QIWI",
"title": "WALLET",
"type": {
"id": "WALLET",
"title": "QIWI Wallet"
},
"hasBalance": true,
"balance": {
"amount": 8.74,
"currency": 643
},
"currency": 643
}
]
}
# wallet number as 79992223344
mylogin = '79999999999'
api_access_token = '975efd8e8376xxxb95fa7cb213xxx04'
# All balances
balances = balance(mylogin,api_access_token)['accounts']
# Ruble account balance
rubAlias = [x for x in balances if x['alias'] == 'qw_wallet_rub']
rubBalance = rubAlias[0]['balance']['amount']
Repeated request when you got empty "balance" object and "hasBalance": true in response
GET /funding-sources/v2/persons/79115221133/accounts?timeout=1000&alias=qw_wallet_rub HTTP/1.1
Accept: application/json
Authorization: Bearer YUu2qw048gtdsvlk3iu
Host: edge.qiwi.com
Successful response is JSON array of all active balances of your QIWI wallet used for payment funding:
Response field | Type | Description |
---|---|---|
accounts | Array[Object] | Array of balances |
accounts[].alias | String | User balance alias |
accounts[].fsAlias | String | Bank account alias |
accounts[].bankAlias | String | Bank alias |
accounts[].title | String | Wallet account name |
accounts[].hasBalance | Boolean | Flag of actual QIWI Wallet balance (not a linked card or cell phone balance or something like that) |
accounts[].currency | Number(3) | Currency of the balance (ISO-4217). Only balances in following currencies are returned: 643 - Russian ruble, 840 - USD, 978 - Euro |
accounts[].type | Object | Account information |
type.id, type.title | String | Account title |
accounts[].balance | Object | Balance data. If null is returned and accounts[].hasBalance is true , repeat the request with additional parameters:timeout=1000 and alias="accounts[].alias" (alias of that balance) |
balance.amount | Number | Текущий баланс данного счета |
balance.currency | Number(3) | Код валюты баланса (ISO-4217) |
Creates a new account and its balance in your QIWI wallet. List of account types which you can create is provided by other request.
curl -X POST \
"https://edge.qiwi.com/funding-sources/v2/persons/<wallet/accounts" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <API token>" \
-d '{ "alias": "qw_wallet_eur"}'
POST /funding-sources/v2/persons/<wallet>/accounts HTTP/1.1
Accept: application/json
Authorization: Bearer <API token>
Content-type: application/json
Host: edge.qiwi.com
{ "alias": "qw_wallet_eur" }
-
- personId - your wallet number without + sign
-
- Accept: application/json
- Content-type: application/json
- Authorization: Bearer ***
- In JSON body of the request:
Name | Type | Description |
---|---|---|
alias | String | Alias of the new account (taken from Available accounts) |
HTTP/1.1 201 Created
Successful response contains HTTP code 201
.
Provides all possible account aliases for your QIWI wallet.
curl -X GET \
"https://edge.qiwi.com/funding-sources/v2/persons/<wallet>/accounts/offer" \
--header "Accept: application/json" \
--header "Authorization: Bearer <API token>"
GET /funding-sources/v2/persons/<wallet>/accounts/offer HTTP/1.1
Accept: application/json
Authorization: Bearer <API token>
Host: edge.qiwi.com
-
- personId - your wallet number without + sign
-
- Accept: application/json
- Authorization: Bearer ***
HTTP/1.1 200 OK
Content-Type: application/json
{ { "alias": "qw_wallet_eur", "currency": 978 }, {} }
Successful JSON response contains a list of accounts available for creation:
Response field | Type | Description |
---|---|---|
{} | Object | List of accounts |
Object.alias | String | Alias of the account |
Object.currency | Number(3) | Account's currency code (ISO-4217) |
Sets up default account in your QIWI wallet for funding all payments. The account must be in the list of available accounts
curl -X PATCH \
"https://edge.qiwi.com/funding-sources/v2/persons/<wallet>/accounts/qw_wallet_usd" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <API token>" \
-d '{ "defaultAccount": true }'
PATCH /funding-sources/v2/persons/<wallet>/accounts/qw_wallet_usd HTTP/1.1
Accept: application/json
Authorization: Bearer <API token>
Content-type: application/json
Host: edge.qiwi.com
{ "defaultAccount": true }
-
- personId - your wallet number without + sign
- accountAlias - account's alias in the wallet, from a list (see parameter accounts[].alias in response)
-
- Accept: application/json
- Content-type: application/json
- Authorization: Bearer ***
- Parameter in JSON body:
Name | Type | Description |
---|---|---|
defaultAccount | Boolean | Flag of default account |
HTTP/1.1 204 Modified
Successful response has HTTP code 204
.