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

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [30202] Cancel/Refund Post-Authorization
## 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>
~~~
{
"OperationID": ,
"Sum": ,
"ticket": [],
"cashiersignature": "",
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
|`OperationID`|Yes|Integer|Unique operation identifier in the Operator system, transmitted in response to the request [[102070221]](https://hackmd.io/CM0Mt9FATVS3cWkihWG_bA).|`4576`|
|`Sum`|Yes|Integer|Total refund sum in kopecks. |1UAH=>`100`|
|`Transaction`|Yes|Structure|Structure transmits the transaction data. See section "[Transaction Structure](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ?view#2-Data)".|See example below.|
*Parameters `ticket` and `cashiersignature` are transmitted if the operation is required to be fiscalized, see details in request [[10005]](https://hackmd.io/qSkRHz6gRKmxNrWRwwrjqg?both#%E2%80%9CTicket%E2%80%9D-Array).*
:::success
<details>
<summary>Example of the "Data" structure</summary>
<br>
~~~md
{
"Sum": 3000,
"ticket": [
{
"ID": "RD009732",
"Good": "Sour cream 20% fat TM Prostokvashino 350g/20",
"Count": 1000,
"Price": 3000,
"uktzed": "0403"
}
],
"OperationID": 54142896,
"Transaction": {
"TransactionID": "321643_1643975265",
"TerminalID": "0",
"DateTime": "20220406 08:07:09"
}
}
~~~
</details>
:::
:::success
<details>
<summary>Example of the request [30202]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 30202
},
"Data": "{\"Sum\": 3000, \"ticket\": [{\"ID\": \"RD009732\", \"Good\": \"Sour cream 20% fat TM Prostokvashino 350g/20\", \"Count\": 1000, \"Price\": 3000, \"uktzed\": \"0403\"}], \"OperationID\": 54142896, \"Transaction\ ": {\"TransactionID\": \"321643_1643975265, \"TerminalID\":\"0\", \"DateTime\":\"20220406 08:07:09\"\"}}",
"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)"*.
### Response Examples
:::success
<details>
<summary>Operation Successfully Completed</summary>
<br>
~~~md
{
"Code": 200,
"Message": "operation ok",
"Data": {
"OperationID": 4576,
"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
[[10001/10002] Confirm/Сancel Pre-Authorization for Operations [10102/101023/101025]](https://hackmd.io/GQcXQzGIRnmpnUW113fQGw)
[[102070221/102070222/102070251/102070252] Confirm/Сancel Pre-Authorization](https://hackmd.io/CM0Mt9FATVS3cWkihWG_bA)
[[30201/302013/302015] Cancel/Refund Payment for Operations [10102/101023/101025]](https://hackmd.io/VUh6hQpySFOsJV9yOzzgow)
[[30203] Cancel/Refund Checkout Payment](https://hackmd.io/cQmrZWV5QY-QbWDTBiCB2g)
## 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>