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

:arrow_left: [Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
# [104121] Auto Debit by Token. MO/TO Operations
*What is "Token Payment" and how the cards are tokenized, see in the section ["Token Payment"](https://hackmd.io/hELnx1lqQwS9RiactYbLEA).*
*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
The Partner's access to the "auto-debit" option is provided in exceptional cases, in which the Partner gets the opportunity to automatically debit funds from the client's card without card authorization ([MO/TO-operations](https://en.wikipedia.org/wiki/Card_not_present_transaction)) according to the Partner rules. For operation execution, it is enough to transmit the phone number, sum and client's card token in the request.
## 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>
~~~
{
"Phone": "",
"Sum": ,
"ClientToken": "",
"Purpose": "",
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
},
"BrowserData": {
"device": {
"channel": ""
},
"browserIP": "",
"browserTZ": ,
"browserLanguage": "",
"browserUserAgent": "",
"browserColorDepth": ,
"browserJavaEnabled": ,
"browserScreenWidth": ,
"browserScreenHeight": ,
"fraudhuntFingerprint": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Phone` | Yes | String | Client phone number in format: "380xxxxxxxxxxxx". |`380679335544`|
| `Sum` | Yes | Integer| Operation sum in kopecks. |1UAH=>`100`|
|`ClientToken`|Yes|String|Client card token.|`d1d2a97aac30eefd26959842-55d2bf3b236a2f84b4e8e2a1-d12c291f4e669`|
| `Purpose` |No| String | Payment purpose. |`Payment Order No.333`|
|`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.|
:::success
<details>
<summary>Example of "Data" structure</summary>
<br>
~~~md
{
"Phone": "380932799111",
"Sum": 10000,
"ClientToken": "d1d2a97aac30eefd2d6984255d2bf3b2316a2f84b4e8e2a1d1b2c291f4e669",
"Purpose": "Payment Order No.333",
"Transaction": {
"TransactionID": "PAY_xpay_50b21b8b583247f28d3d4b0a2fb4bec",
"TerminalID": "1",
"DateTime": "20220619 063111"
}
}
~~~
</details>
:::
## Response
*See the general information on the response structure formation in the section "[General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ?view#Response-Structure)"*.
### Response Examples
:::success
<details>
<summary>Operation Successfully Completed</summary>
<br>
~~~md
{
"Code": 200,
"Message": "done",
"Data": {
"OperationID": 555,
"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
[[10101] Card-Card](https://hackmd.io/VYlXRMiWRkimK0sxlTZ2BA)
[[10102/101023/101025] Card-Wallet](https://hackmd.io/MUZzd3mTRQeQfBsE-emVVQ)
[[10103] Card-IBAN of Individual](https://hackmd.io/9c9kaHeMTH-LiGf_mVWwpg)
[[101031] Card-IBAN of Legal Entity](https://hackmd.io/XQDv9qmoRiqFzfzcD0H1uA)
[[10150/10051] Card-Phone-Card](https://hackmd.io/ES9hW5BlS6CozQAmULgnRw)
**Token Payment**
[[104021] Card Payment by Token](https://hackmd.io/I4FJ0d0eStuvfqG2YmS8IQ)
[[1040217] Bulk Card Payment by Token](https://hackmd.io/6h9zyYaBTwOLzzP8XJDrfg)
**Get Card Data**
[[20400/20410] Get Card Data by Phone Number](https://hackmd.io/Xd9OZWXARcSZRTCsu-1jrw)
[[20404] Get Card Data by Token](https://hackmd.io/PSdh1ldNSmmJMR4OIhM_-Q)
**Get Transaction Data**
[[20003] Get Operation Status](https://hackmd.io/_eAjmoG-QPWoWWmsLOGf1g)
## 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>