[УКР](https://hackmd.io/L9EeXtQYRDCQD_IhAPKhMw) | ENG

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [20002] Get Wallet Statement
## Usage
Request [20002] is used to get the wallet statement for the specified time period.
## 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
The Data structure for this operation is formed from the following parameters:
:::info
<details>
<summary>Data structure formation (examples are below)</summary>
<br>
~~~
{
"ID": "",
"DateStart": "",
"DateFinish": "",
"Decrypted":
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
|`ID`|Yes - for several wallets.|String|Unique wallet identifier in the Operator system. If the value is empty - the statement is generated for all Partner wallets.|`UAH897589401`|
|`DateStart`|No|String|Start date of the statement period in the format: YYYY-MM-DD 24HH:MM:SS.|`2022-06-20 12:00:00`|
|`DateFinish`|No|String|End date of the statement period in the format: YYYY-MM-DD 24HH:MM:SS.|`2022-06-21 12:00:00`|
|`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 [20002]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 20002
},
"Data": "{\"Decrypted\": true, \"ID\": \"UAH123456789\", \"DateStart\": \"2022-06-20\", \"DateFinish\": \"2022-06-21\"}",
"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)"*.
Successful response to the request [20002] contains the `decodedData`/`encodedData` structure array, that transmits unencrypted or encrypted statement details. Structure parameters are optional and individually configured depending on the operation type and Partner's needs.
Main parameters are:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Sum` | No |Integer | Operation sum in kopecks. |1UAH=>`100`|
|`State`^1^|No|String|Operation status. See possible values. below. |`Done`|
|`DateTime`|No|String|Date and time of operation in the format: YYYY-MM-DD HH24:MM:SS.|`2022-07-17T15:54:11+03:00`|
| `FirstName` | No | String | Client name. |`Oleg`|
| `MiddleName` | No | String | Client middle name. |`Mykhaylovich`|
| `LastName` | No | String | Client last name. |`Podilskyi`|
| `CellPhone` | No | String | Client phone number in the format: "380xxxxxxxxxxxx". |`380679335544`|
|`TransactionID`|No|String|Unique transaction identifier in the Operator system.| `10000623751721`|
|`Extterminalid`|No|String|Unique terminal identifier in the Partner system.|`11`|
|`Exttransactionid`|No|String|Unique transaction identifier in the Partner system.|`14588`|
|`SenderWalletID`|No|String|Unique identifier of the sender's wallet in the Operator system. |`UAH703758543`|
|`RecipientWalletID`|No|String|Unique identifier of the recipient's wallet in the Operator system.|`UAH271057865`|
^1^ **"State"** Structure Parameters:
|Operation Status|Finality|Result|
|:----:|:----:|:----:|
|`Created`|No|Created.|
|`Processed`|No|In process.|
|`Done`|Yes|Completed.|
|`Declined`|Yes|Declined.|
|`Canceled`|Yes|Cancelled.|
### Response Example
:::success
<details>
<summary>Formation of wallet statement in unencrypted form</summary>
<br>
~~~md
{
"Code": 200,
"Message": "done",
"Data": {
"OperationDate": "2022-07-19T09:22:11.625775+03:00",
"OperationID": 71637250,
"OperationStatus": 10,
"decodedData": "[{\"Sum\": 33912, \"State\": \"Done\", \"BankDate\": \"2022-07-18T07:41:59.649326+03:00\", \"DateTime\": \"2022-07-17T15:54:11+03:00\", \"LastName\": \"1\", \"CellPhone\": \"390953020919\", \"FirstName\": \"X\", \"Extterminalid\": \"11\", \"TransactionID\": \"10000623751721\", \"SenderWalletID\": \"UAH423159687\", \"Exttransactionid\": \"92fe0186-ae57-449e-ac41-51e35d1152a8\", \"RecipientWalletID\": \"UAH979602379\"}, {\"Sum\": 20000, \"State\": \"Done\", \"BankDate\": \"2022-07-18T07:41:59.649326+03:00\", \"DateTime\": \"2022-07-17T15:54:05+03:00\", \"LastName\": \"1\", \"CellPhone\": \"390953020919\", \"FirstName\": \"X\", \"Extterminalid\": \"1\", \"TransactionID\": \"10000166351711\", \"SenderWalletID\": \"UAH423159687\", \"Exttransactionid\": \"491cf229-37be-49a4-add2-f5cd33352193\", \"RecipientWalletID\": \"UAH885380155\"}, {\"Sum\": 34488, \"State\": \"Done\", \"BankDate\": \"2022-07-18T07:41:59.649326+03:00\", \"DateTime\": \"2022-07-17T14:57:31+03:00\", \"LastName\": \"1\", \"CellPhone\": \"390953020919\", \"FirstName\": \"X\", \"Extterminalid\": \"8\", \"TransactionID\": \"10000547751719\", \"SenderWalletID\": \"UAH423159687\", \"Exttransactionid\": \"63fdfbe3-8f0f-4c65-855c-7eccaabcbbbf\", \"RecipientWalletID\": \"UAH531753698\"}]"
},
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
## Related Requests
[[20001] Get Wallet Balance](https://hackmd.io/SVZQwSioRiGRiy0JwUQFWw)
[[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)
[[20110] Get Card Data](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>