[УКР](https://hackmd.io/W25MdduPQFidcqLdTWIbpg) | ENG ![](https://i.imgur.com/ULmPUgP.jpg) :arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw) # [30201/302013/302015] Cancel/Refund Payment for Operations [10102/101023/101025] ## Usage |OperationType |Usage | |:----:|----| |`30201`|Cancel/Refund Payment for Operation [[10102]](https://hackmd.io/MUZzd3mTRQeQfBsE-emVVQ).| |`302013`|Cancel/Refund Payment for Operation [[101023]](https://hackmd.io/MUZzd3mTRQeQfBsE-emVVQ).| |`302015`|Cancel/Refund Payment for Operation [[101025]](https://hackmd.io/MUZzd3mTRQeQfBsE-emVVQ).| ## 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": "", "MIDs": [ { "MID": , "Sum": , "PaymentInfo": [ { "Caption": "", "Value": "" } ], "Account": "", "EDRPOU": "", "MFO": "", "Name": "" } ], "Transaction":{ "TransactionID": "", "TerminalID": "", "DateTime": "" } } ~~~ </details> ::: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| |`OperationID`|Yes|Integer (for [302013] can be string) |Unique operation identifier in the Operator system that requires the refund.|`4576`| |`Sum`|No|Integer|Total refund sum in kopecks. When the parameter is missing, the refund sum is equal to the debit sum. |1UAH=>`100`| | `MIDs`^1^ | No - for [30201]; Yes - for **[302013/302015]** | Array | Array is used to split the accepted payment in favor of the merchants. | See example below.| |`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).* ^1^ **"MIDs"** array parameters: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| | `MID` |Yes| Integer | Merchant ID in the Operator system, to which wallet funds are credited. |`111`| | `Sum` | Yes |Integer | Payment sum in kopecks. |1UAH=>`100`| | `PaymentInfo`^2^ | No | Array | Parameter is used to display additional payment details on the payment page ("payment purpose"). | See example below.| | `Account` |No| String | Recipient current account or IBAN (international bank account number). | `UA4830529900000 26008031203677`| |`EDRPOU`|No|String | Recipient ["EDRPOU"](https://uk.wikipedia.org/wiki/%D0%9A%D0%BE%D0%B4_%D0%84%D0%94%D0%A0%D0%9F%D0%9E%D0%A3) code.|`3505506226` | | `MFO` |No |String | Recipient "[Bank Sort Code](https://en.wikipedia.org/wiki/Sort_code). |`305299`| | `Name` | No | String | Recipient name. |`Resource LLC`| ^2^ **"PaymentInfo"** Array Parameters: |Parameter|Required|Type|Description|Example| |:----:|:----:|:----:|----|:----:| | `Caption` |Yes| String | Description of additional information. |`Purpose`| | `Value` |Yes| String | Additional Information. |`Contract Repayment No. 3642989012-5 from 04/03/2021 Pupkina Valeriya Serhiivna`| :::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" } ], "MIDs": [ { "MID": 111, "Sum": 100, "PaymentInfo": [ { "Caption": "Purpose", "Value": "Contract Repayment No.3642989012-5 dated 04/03/2021 Pupkina Valeriya Serhiivna" } ], "Account": "UA483052990000000008031203000", "EDRPOU": "3505501111", "MFO": "123456" }, { "MID": 112, "Sum": 200, "PaymentInfo": [ { "Caption": "Purpose", "Value": "Contract Repayment No.3642989012-5 dated 04/03/2021 Pupkina Valeriya Serhiivna" } ], "Account": "UA483052990000000008031203000", "EDRPOU": "3505501111", "MFO": "123456" } ], "OperationID": 54142896, "Transaction": { "TransactionID": "321643_1643975265", "TerminalID": "1", "DateTime": "20220406 08:07:09" } } ~~~ </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) [[30202] Cancel/Refund Post-Authorization](https://hackmd.io/kRNsz_UtQZKviJnWG238HA) [[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. ![](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>