[УКР](https://hackmd.io/3BzRqynvSF-J7fhcZCZDXA) | ENG

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [30203] Cancel/Refund Checkout Payment
## 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>
~~~
{
"TxnID": "",
"Sum": ,
"ticket": [],
"cashiersignature": "",
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
|`TxnID`|Yes|String|Unique operation identifier in the Operator system. It is parameter `txn_id`, transmitted in the "[pay](https://hackmd.io/r0If47QcT-qyFuNvGEN2Wg)" request.|`321455`|
|`Sum`|No|Integer|Refund sum in kopecks. Parameter is transmitted in case of partial return. When no parameter is transmitted, a full refund is executed.|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 request [30203]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 30203,
"Locale": "uk"
},
"Data": "{\"Transaction\":{\"TerminalID\":\"1\",\"TransactionID\":\"202204064312\", \"DateTime\":\"20220406 08:07:09\"},\"TxnID\":\"12633661\"}",
"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)
[[30202] Cancel/Refund Post-Authorization](https://hackmd.io/kRNsz_UtQZKviJnWG238HA)
## 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>