[УКР](https://hackmd.io/c-2sDICDRGeplJ-QL8bETw) | ENG

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [20001] Get Wallet Balance
## Usage
Request [20001] is used to get the current wallet balance.
## Request
*See the description of the "Partner", "KeyAES" and "Sign" attributes in the section "[General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ)".*
### Data Structure
Data structure for this operation is formed from the following parameters:
:::info
<details>
<summary>Data structure formation (examples are below)</summary>
<br>
~~~
{
"ID": "",
"Decrypted":
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
|`ID`|Yes - for several wallets.|String|Unique wallet identifier in the Operator system for which the balance is formed.|`UAH897589401`|
|`Decrypted`|No|Boolean|Sign of unencrypted response: </br> `true` - unencrypted form of response; </br> `false` (default value) - encrypted form of response.|`true`|
:::success
<details>
<summary>Example of the request [20001]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 20001
},
"Data": "{\"Decrypted\": true, \"ID\": \"UAH897589401\"}",
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
## Response
*See the general information on the response structure formation in the section "[General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ)"*.
### Data Structure
Successful response to the request [20001] contains the structure `decodedData`/`encodedData`, that transmits unencrypted or encrypted wallet balance data:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Sum` |Yes | Integer | Wallet balance in kopecks. |1UAH=>`100`|
|`ID`|Yes|String|Unique wallet identifier in the Operator system. |`UAH897589401`|
|`DateTime`|No|String|Date and time of the balance request in the format: YYYY-MM-DD HH24:MM:SS.|`2018-08-30T11:59:56+03:00`|
### Response Examples
:::success
<details>
<summary>Formation of wallet balance in unencrypted form</summary>
<br>
~~~md
{
"Code": 200,
"Message": "done",
"Data": {
"OperationDate": "2022-07-01T06:30:00.985179+03:00",
"OperationID": 9397318,
"OperationStatus": 10,
"decodedData": "{\"ID\":\"UAH897589401\",\"Sum\":50000,\"DateTime\":\"20180510 13:23:19\"}"
},
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
:::success
<details>
<summary>Formation of wallet balance in encrypted form</summary>
<br>
~~~md
{
"Code": 200,
"Message": "done",
"Data": {
"OperationDate": "2022-07-01T06:30:00.985179+03:00",
"OperationID": 9397318,
"OperationStatus": 10,
"encodedData": "qJfPZG1jvzr1vA/eLcUc2FodP3tF2YiTN5YLck+wYTKcyXwA+RLvqkXzzOVoRop6u8hJbLYcd/iFx7cf6x/AB1oQ3EfWs99R4wT2xjyaVKE="
},
"KeyAES": "GVUYl0x/c1VzB8RwVHO3ktRvwb5Z4haVfdgqBKSrRTRQiqo/RXygI7W2YAJ/kjEDBbKRa8pig8q9qme2TiF6zcpXMIA9prqydurp5mZSaPrvCy1s6gmz1xddF2Wkpe3nJIotWOjvItbO1BcCUdBOCAeCp/tWLPnGdHOUnrapI6SZi0cKOLcBzVARMD91KTqPhNg3DE809bcXRdGSukZQfNNvTSG2ITd/+L5J623BBexLgtwwLj0AXivcmEwvKJl65IhzSos3zCJ2CFrFqvg+j3mZQmR7B8L6ysopVlmh5QrcLv7XvfaoZwW+jhxWFuc63KW9S8VfuhjbQC0VcnXssQ==",
"Sign": "CkLM5Y6LVsj9q2NIq6uiHwaOYwE2o7RWBFh2VHc7QHdeUM7vC5tJptdrXNvae/5dJ2pjejrRNot9mQVh8Fhp6h+tYxqK0DkXd7L/SPfF5WUFEsliHrHEipGMLOI1vHV9wvkhNWzjpKhK44BOVfdxxt8Uocz4FPRZlIxyjg3TsBvtb+zCOKK7BshdjBF8YKh5h22x0nOJ+0e/OwmC5xN1s3+NH7UNULzisaX5zUQ4V6sYIK0snNJexBDrq43llZ3Y0hfyz2ggwS34bEC+i9t4DPw/Sg6s30QafsgAVw4EvQGc3505Xd003J0QVQfStPxs+5ela7GWDJ4/tTCCEFRnew=="
}
~~~
</details>
:::
## Related Requests
[[20002] Get Wallet Statement](https://hackmd.io/ChiiYaRgQVeZcjvM5Wt7VA)
[[20003] Get Operation Status](https://hackmd.io/_eAjmoG-QPWoWWmsLOGf1g)
[[20004] Get Transaction Receipt](https://hackmd.io/k3KrwPbcRK-1G7qxG0ORlg)
[[20008] Get Exchange Rate](https://hackmd.io/k_ZnVoMwQ-i4WelDZ0wtZA)
[[20009] Get Limit for Operation [10101]](https://hackmd.io/rQ7epWnbQmG9kM0rFjUfhA)(https://hackmd.io/WruG7PGDRsuF0gL0Wl21bA)
## Reference Materials
General parameters of the XPAY system are given in the section ["Reference Materials"](https://hackmd.io/16yLv895Qo-FWTvrWWQwbg): operation types, payment types, response codes, operation status, reasons of operation rejection, etc.

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
:arrow_left: [General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ)
<details>
<summary>XPAY Support</summary>
</br>
Phone: +38 093 891 92 00
Email: info@xpay.com.ua
Telegram: @xpaysupportbot
</details>