[УКР](https://hackmd.io/f8cr3qN-QU27s2pAyU39bQ) | ENG

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [10108] Debt Repayment
*What is "Server-Server card payment" and how the sender is authenticated, see in the section "[Server-Server Card Payment](https://hackmd.io/83UDlVHPRf2CxEBCi6ECBg)".*
## Usage
Request [10108] is used for the card debt repayment according to the data received in the response to the request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g).
## 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
Data structure for this operation is formed from the following parameters:
:::info
<details>
<summary>Data structure formation (examples are below)</summary>
<br>
~~~
{
"Sum": ,
"SenderCard": {
"PAN": "",
"ExpMon": "",
"ExpYear": "",
"CVV": ""
},
"payments": {
"id_plat_klient": ,
"change_data": [
{
"id_plat_plat": ,
"summ": ,
"counters": [
{
"id_plat_counters": ,
"old_value": ,
"new_value":
}
]
}
]
},
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
},
"BrowserData": {
"device": {
"channel": ""
},
"browserIP": "",
"browserLanguage": "",
"browserUserAgent": "",
"fraudhuntFingerprint": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Sum` | Yes |Integer | Total repayment sum in kopecks. |1UAH=>`100`|
|`SenderCard`^1^|Yes|Structure|Structure transmits sender's bank card data.|See example below.|
|`payments`^2^|Yes|Structure|Structure transmits data about the service payer and details of debt repayment.|See example below.|
|`BrowserData`|No|Structure|Structure transmits browser data for *3DSecure 2.0*. See section ["BrowserData structure"](https://hackmd.io/83UDlVHPRf2CxEBCi6ECBg#%E2%80%9CBrowserData%E2%80%9D-structure).|See example in section ["BrowserData structure"](https://hackmd.io/83UDlVHPRf2CxEBCi6ECBg#%E2%80%9CBrowserData%E2%80%9D-structure).|
|`Transaction`|Yes|Structure|Structure transmits transaction data. See section "[Transaction Structure](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ?view#2-Data)".|See example below.|
^1^ **"SenderCard"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `PAN` | Yes | String[16] | Sender card PAN (bank card number). | `8888888888888888` |
|`ExpMon`|Yes|String[2]|Month of card validity. Parameter is aligned to 2 digits by the symbol "0".|`02`|
|`ExpYear`|Yes|String[2]|Last 2 digits of the card's expiration year. Parameter is aligned to 2 digits by the symbol "0".|`22`|
|`CVV`|Yes|String[3]|CVV card code.|`356`|
^2^ **"payments"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `id_plat_klient` | Yes |Integer | Unique identifier of the service payer received in the response to the request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g) - parameter `ID_PLAT_KLIENT`. |`383064108`|
|`change_data`^3^|Yes|Array | Array of structures transmits payment details and debt changes.|See below.|
^3^ **"change_data"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `id_plat_plat` | Yes |Integer | Unique identifier of the payee, received in the response to the request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g) - parameter `ID_PLAT_PLAT`. |`339241865601`|
|`summ`|Yes|Integer|Repayment sum in kopecks. |1UAH=>`100`|
|`counters`^4^|No|Array | Array of structures transmits counters’s data.|See below.|
^4^ **"counters"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `id_plat_counters` | Yes |Integer | Unique identifier of the counter, received in the response to the request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g) - parameter `ID_PLAT_COUNTERS`. |`14781385901`|
|`old_value`|Yes|Integer|Old counter value, received in response to the request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g). |`0`|
|`new_value`|Yes|Integer|New counter value, received in response to request [[20802]](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g). |`10`|
:::success
<details>
<summary>Example of the "Data" structure</summary>
<br>
~~~md
{
"Sum": 1000,
"SenderCard": {
"CVV": "***",
"PAN": "535124******0453",
"ExpMon": "12",
"ExpYear": "24"
},
"payments": {
"id_plat_klient": 382835070,
"change_data": [
{
"id_plat_plat": 339241865601,
"summ": 110
},
{
"id_plat_plat": 339241865501,
"summ": 210,
"counters": [
{
"id_plat_counters": 14781385901,
"old_value": 0,
"new_value": 10
}
]
}
]
}
}
~~~
</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>Request successfully accepted and needs "3DS" verification</summary>
<br>
~~~md
{
"Code": 102,
"Message": "need3ds",
"Data": {
"OperationID": 111,
"3dsHtml": "<html page in base64 encoding>",
"OperationStatus": 2
},
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
:::success
<details>
<summary>Request successfully accepted and needs "OTP" verification</summary>
<br>
~~~md
{
"Code": 102,
"Message": "needOTP",
"Data": {
"OperationID": 111,
"otpJson": "<JSON structure as string>",
"OperationStatus": 3
},
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
:::success
<details>
<summary>Operation Successfully Completed</summary>
<br>
~~~md
{
"Code": 200,
"Message": "Done",
"Data": {
"ID_PLAT_KLIENT": 382835070,
"KOMIS": [
null
],
"PLATS": [
{
"ID_PLAT_PLAT": 339241865601,
"FIRME": "EURO-RECONSTRUCTION LIMITED LIABILITY COMPANY",
"SERVICE_LABEL": "AP (subscription fee)",
"ABCOUNT": "1*34",
"SUMM": 110,
"DTIME": "2022-06-22T15:20:55Z",
"MONEY_ID": 0,
"COUNTERS": null
},
{
"ID_PLAT_PLAT": 339241865401,
"FIRME": "EURO-RECONSTRUCTION LIMITED LIABILITY COMPANY",
"SERVICE_LABEL": "Fees for the maintenance of the commercial thermal energy accounting node",
"ABCOUNT": "1*34",
"SUMM": 37.33,
"DTIME": "2022-06-22T15:20:55Z",
"MONEY_ID": 0,
"COUNTERS": null
},
{
"ID_PLAT_PLAT": 339241865301,
"FIRME": "EURO-RECONSTRUCTION LIMITED LIABILITY COMPANY",
"SERVICE_LABEL": "CENTRAL HEATING",
"ABCOUNT": "1*34",
"SUMM": 6206.69,
"DTIME": "2022-06-22T15:20:55Z",
"MONEY_ID": 0,
"COUNTERS": null
},
{
"ID_PLAT_PLAT": 339241865501,
"FIRME": "EURO-RECONSTRUCTION LIMITED LIABILITY COMPANY",
"SERVICE_LABEL": "CENTRALIZED HOT WATER SUPPLY",
"ABCOUNT": "1*34",
"SUMM": 210,
"DTIME": "2022-06-22T15:20:55Z",
"MONEY_ID": 0,
"COUNTERS": [
{
"ID_PLAT_COUNTERS": 14781385901,
"NCOUNTERS": 1,
"OLD_VAL": 0,
"NEW_VAL": 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
[[20801] Get Directory Data](https://hackmd.io/8x6rVjR-SnOj1HHwAfa8tg)
[[208011] Get Directory City Data](https://hackmd.io/LZsuqpBMR-iPJcnBKS7DmA)
[[20802] Get Debt Data](https://hackmd.io/GuQz5QT-RpGfdoqKjhMd8g)
## 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>