[УКР](https://hackmd.io/inushlCxQa2f0MRgvVD7eg) | ENG ![](https://i.imgur.com/ULmPUgP.jpg) :arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw) # [20008] Get Exchange Rate ## Usage Request [20008] is used to get the current exchange rate. ## 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> ~~~ { "CurrencyRate": [ { "From": "", "To": "", "Type": "" } ] } ~~~ </details> ::: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| | `CurrencyRate` | Yes | Array | Array that transmits exchange rate data. | See example below.| ^1^ **"CurrencyRate"** Structure Parameters: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| | `From` | Yes |String | Currency code from which funds are converted, according to the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) standard ("UAH", "GBP", "USD", etc.). |`USD`| | `To` | Yes |String | Currency code to which the funds are converted, according to the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) standard ("UAH", "GBP", "USD", etc.). |`UAH`| | `Type` | Yes |String | Exchange rate provider. |`MTB`| :::success <details> <summary>Example of the "Data" structure</summary> <br> ~~~md { "CurrencyRate": [ { "From": "USD", "To": "UAH", "Type": "MTB" }, { "From": "UAH", "To": "USD", "Type": "MTB" } ] } ~~~ </details> ::: :::success <details> <summary>Example of the request [20008]</summary> <br> ~~~md { "Partner": { "PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1", "OperationType": 20008 }, "Data": "{\"CurrencyRate\":[{\"From\":\"USD\",\"To\":\"UAH\",\"Type\":\"MTB\"},{\"From\":\"UAH\",\"To\":\"USD\",\"Type\":\"MTB\"}]", "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 [20008] contains the array `CurrencyRate`, that transmits the current exchange rate data: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| | `From` | Yes |String | Currency code from which funds are converted, according to the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) standard ("UAH", "GBP", "USD", etc.). |`USD`| | `Rate` | Yes |String | Current exchange rate of the currency pair. |`0.3703703703703704`| | `To` | Yes |String | Currency code to which the funds are converted, according to the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) standard ("UAH", "GBP", "USD", etc.). |`UAH`| | `Type` | Yes |String | Exchange rate provider. |`MTB`| ### Response Examples :::success <details> <summary>Operation Successfully Completed</summary> <br> ~~~md { "Code": 200, "Message": "Done", "Data": { "CurrencyRate": [ { "From": "USD", "Rate": 0.3703703703703704, "To": "UAH", "Type": "MTB" }, { "From": "UAH", "Rate": 2.7, "To": "USD", "Type": "MTB" } ], "OperationDate": "2022-10-13T16:01:10.910404+03:00", "OperationID": 2313790, "OperationStatus": 10 }, "KeyAES": "", "Sign": "" } ~~~ </details> ::: :::success <details> <summary>Operation Successfully Completed - Null Rate Value</summary> <br> ~~~md { "Code": 200, "Message": "Done", "Data": { "CurrencyRate": [ { "From": "USD", "Rate": null, "To": "UAH", "Type": "MTB" }, { "From": "UAH", "Rate": null, "To": "USD", "Type": "MTB" } ], "OperationDate": "2022-10-13T16:02:54.258959+03:00", "OperationID": 2313791, "OperationStatus": 10 }, "KeyAES": "", "Sign": "" } ~~~ </details> ::: :::success <details> <summary>Operation Failed</summary> <br> ~~~md { "Code": 200, "Message": "done", "Data": { "OperationID": 111, "OperationStatus": 21, "Reason": 3 }, "KeyAES": "", "Sign": "" } ~~~ </details> ::: ## Related Requests [[20001] Get Wallet Balance](https://hackmd.io/SVZQwSioRiGRiy0JwUQFWw) [[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) [[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. ![](https://i.imgur.com/17gAyWb.png) :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>