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

:arrow_left: [Guide](https://hackmd.io/pa6TRNZTTa67jO_qYDuRBQ)
# [40005] Get Frame to Add Card
## Usage
Request [40005] is used to get a frame link for adding card.
## 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>
~~~
{
"UserID": "",
"Phone": "",
"Email": "",
"DeviceID": "",
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
|`UserID`|No |String|Unique client identifier in the Partner system.|`Uwuh0B5GQVuokYSL`|
| `Phone` | Yes | String | Client phone number in the format "380xxxxxxxxxxxx". |`380679335544`|
| `Email` | No | String | Client email. |`index@gmail.com`|
|`DeviceID`|Yes |String|Unique identifier of the client device.|`0Ht9z0yh5aDNr5-js1zGFz5QTmIE=`|
|`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 the request [40005]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "664e545e-5916-4f7b-acb5-027d44c94cc2",
"OperationType": 40005,
"Locale": "ru"
},
"Data": "{\"UserID\":\"551151\", \"Phone\":\"380954097668\", \"Email\":\"Genixgandon@icloud.com\", \"DeviceID\":null, \"Transaction\": {\"TransactionID\":\"921402\", \"TerminalID\":\"1\", \"DateTime\":\"2022-10-31 13:52:20\"}}",
"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?view#Response-Structure)"*.
### Data Structure
Successful response to the request [40005] contains an `URI` parameter, in which a frame link is transmitted.
### Response Examples
:::success
<details>
<summary>Operation Successfully Completed</summary>
<br>
~~~md
{
"Code": 200,
"Message": "done",
"Data": {
"OperationID": 11,
"OperationStatus": 10,
"URI": "https://otp.xpay.com.ua/ru/ident-frame/124566543"
},
"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>
:::
### Parameters of Frame Call to Add Card
Frame is called by the POST method to the received URI. POST parameters are:
|Parameter |Valid values |Purpose|
|:----:|:----:|:----|
|`token` |Token from the getting frame request. |Request authorization.|
|`skip_list`| `true/false` </br> Default is `false`. |Force transition to add card mode, bypassing card list.|
|`success_callback_url`| `URI` |URL, to which the client is redirected after successful frame completion. If URI contains the `token=%s` parameter, the token of selected card is substituted instead of `%s`. |
|`callback_type` | `external/internal` </br> Default is `internal`. |Following to the page, when the card is successfully added: </br> - `external` - to the URL specified in "success_callback_url". </br> - `internal` – to the card list page. |
## 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/pa6TRNZTTa67jO_qYDuRBQ)
: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>