[УКР](https://hackmd.io/v5DKCslVSiGacRGLePCrOw) | ENG
# [10301/10311/103013] Wallet-Card
*What is "XPAY Wallet" see in the section ["XPAY Wallet"](https://hackmd.io/bbv1AdS0SwiJeWqW1i1tCA).*
## Usage
|"OperationType" |Usage |
|:----:|----|
|`10301`| Payout from the Partner Wallet to the card.|
|`10311`| Payout from the Partner Wallet to the card using CallbackURL.|
|`103013`| Payout from the Merchant Wallet (MIDs) to the 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
The Data structure for this operation is formed from the following parameters:
:::info
<details>
<summary>Data structure formation (examples are below)</summary>
<br>
~~~
{
"Currency": "",
"Exchange": "",
"CallbackURL": "",
"Purpose": "",
"TransferA2C": {
"Sum": ,
"Phone": "",
"RecipientCard": {
"PAN": "",
"FirstName": "",
"MiddleName": "",
"LastName": "",
"IPN": "",
"document_type_id": "",
"doc_series": "",
"doc_number": "",
"dt_doc_issue": "",
"dt_doc_exp": "",
"doc_issued_by": ""
},
"FirstName": "",
"LastName": "",
"MiddleName": "",
"CompanyName": "",
"CompanyEDRPOU": "",
"CompanyIBAN": ""
},
"MIDs": [
{
"MID": ,
"Sum": ,
"PaymentInfo": [
{
"Caption": "",
"Value": ""
}
],
"Account": "",
"EDRPOU": "",
"MFO": "",
"Name": ""
}
],
"Transaction": {
"TransactionID": "",
"TerminalID": "",
"DateTime": ""
}
}
~~~
</details>
:::
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Currency` | Yes - paying in a currency different from UAH | String | Currency *debit* code is an abbreviated currency designation described in the standard [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) (“GBP”, “USD”, ..). |`USD`|
| `Exchange` | Yes - paying in a currency different from UAH | String | Currency *credit* code is an abbreviated currency designation described in the standard [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Non_ISO_4217_currencies) (“GBP”, “USD”, ..). |`GBP`|
| `CallbackURL` | No. </br> Only for **[10311]** | String | URL to which an additional response will be sent if the operation timeout has expired. The response will return the `TransactionID`, sent by the Partner. For example: {"Code":200, "Message":"Done", "Data":{"OperationID":5639163, "OperationStatus":10, "PspID":"1041299225", **"TransactionID":"50f8804693ef"**, "TransactionStatus":3}, "KeyAES":"", "Sign":""}.|`https://partner.com/callback/xpay1`|
| `Purpose` |No| String | Payment purpose. |`Payment Order No.111`|
|`TransferA2C`^1^|Yes|Structure|Structure transmits the operation data.|See example below.|
| `MIDs`^3^ | No. </br> Yes - for **[103013]** | Array | Array is transmited to make a payment from the merchant's wallet to the service provider, on condition that Partner can use balances of the associated 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.|
^1^ **"TransferA2C"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `Sum` | Yes |Integer | Operation sum in kopecks. |1UAH=>`100`|
| `Phone` | No | String | Client phone number in format: "380xxxxxxxxxxxx". |`380679335544`|
|`RecipientCard`^2^|Yes|Structure|Structure transmits the recipient's bank card data.|See example below.|
| `FirstName` | No | String | Sender name. |`Oleg`|
| `MiddleName` | No | String | Sender middle name. |`Mykhaylovich`|
| `LastName` | No | String | Sender last name. |`Podilskyi`|
|`CompanyName`| No |String | Sender company name. | `TOV "Romashka"`|
|`CompanyEDRPOU`| No | String | Sender company "EDRPOU" code. | `123456789012`|
|`CompanyIBAN`| No | String | Sender company IBAN. | `UA4830529900000 26008031203677`|
^2^ **"RecipientCard"** Structure Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `PAN` | Yes | String[16] | Recipient card PAN (bank card number). | `8888888888888888` |
| `FirstName` | Yes* | String | Recipient name. |`Maxim` |
| `MiddleName` | Yes* | String | Recipient middle name. |`Olegovich`|
| `LastName` | Yes* | String | Recipient last name. |`Kravets`|
| `IPN` | Yes* | String | Recipient individual tax number (IPN). |`111111111111`|
| `document_type_id` | Yes* | Integer | Document type from the directory: </br> `1` - passport, </br> `2` - ID-card. |`1`|
| `doc_series` | Yes* | String | Document series. |`19910824-00026`|
| `doc_number` | Yes* | String | Document number. |`123456789`|
| `dt_doc_issue` | Yes* | String | Date of document issuance. |`2022-06-14`|
| `dt_doc_exp` | Yes* | String | Expiration date of the document. |`2022-06-14`|
| `doc_issued_by` | Yes* | String | Authority that issued the document. |`3459`|
**Parameters are conditionally mandatory (determined at the integration stage).*
^3^ **"MIDs"** Array Parameters:
|Parameter|Required|Type|Description|Example|
|:----:|:----:|:----:|----|:----:|
| `MID` |Yes| Integer | Merchant ID in the Operator system, from which wallet funds are debited. |`111`|
| `Sum` | Yes |Integer | Payment sum in kopecks. |1UAH=>`100`|
| `PaymentInfo`^4^ | No | Array | Parameter is used to display additional payment details on the payment page. | See example below.|
| `Account` |No| String | Sender current account or IBAN (international bank account number). | `UA4830529900000 26008031203677`|
|`EDRPOU`|No|String | Sender ["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 | Sender "[Bank Sort Code](https://en.wikipedia.org/wiki/Sort_code). |`305299`|
| `Name` | No | String | Sender name. |`Resource LLC`|
:::success
<details>
<summary>Example of the "MIDs" data array</summary>
~~~md
{
"MIDs": [
{
"MID": 111,
"Sum": 100,
"PaymentInfo": [
{
"Caption": "Purpose",
"Value": "Contract Repayment No. 3642989012-5 from 04/03/2021 Pupkina Valeriya Serhiivna"
}
]
},
{
"MID": 112,
"Sum": 200,
"PaymentInfo": [
{
"Caption": "Purpose",
"Value": "Contract Repayment No. 3642989012-5 from 04/03/2021 Pupkina Valeriya Serhiivna"
}
]
}
]
}
~~~
</details>
:::
^4^ **"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 request [10301]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 10301
},
"Data": "{\"Transaction\": {\"DateTime\": \"20220704 17:03:40\", \"TerminalID\": \"1\", \"TransactionID\": \" 0c5328f5-bda9-4376-b6a0-ca544fcb34ff\"}, \"TransferA2C\": {\"Sum\": 157500, \"RecipientCard\": {\"PAN\": \"516874****** 0067\"}}}",
"KeyAES": "",
"Sign": ""
}
~~~
</details>
:::
:::success
<details>
<summary>Example of the request [10311]</summary>
<br>
~~~md
{
"Partner": {
"PartnerToken": "72a8ddb8-9145-4a41-af1a-8c48ecaa4be1",
"OperationType": 10311
},
"Data": "{\"CallbackURL\":\"https://echange.su/merchant-ap_xpay_status_uFuzCAlZFvzSI7X1I0ER0RTTDbDo4PKrsJJtxmUDfxJeKEiuonh667hAx0qid3vnrzr.html?order_id=144763\",\"Transaction\":{\"DateTime\":\"2020708 00:32:12\",\"TerminalID\":\"1\",\"TransactionID\":\"144763\"},\"TransferA2C\":{\"Sum\":245779,\" RecipientCard\":{\"PAN\":\"537541******3574\"}}}",
"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": "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
[[10202] Wallet-Wallet](https://hackmd.io/dOi__3dxSYSi_3EvZh2a5Q)
[[10303] Wallet-IBAN](https://hackmd.io/7kfzI0OAQB6Nt8ZN38UxSg)
[[10304] Wallet-UUID](https://hackmd.io/-U0QJEY_TASmrNQGwGepcA)
[[10400] Packet Payment Wallet-Card by Token](https://hackmd.io/BHS4jBINQ-u8SQxX3XvR6Q)
[[10401] Packet Payment Wallet-Card by Card Number](https://hackmd.io/v65TGa0uQPGCrKXQhvHuZg)
**Phone Top-Up**
[[10205] Wallet-Phone](https://hackmd.io/eyewES-3TCGr99R8shURgQ)
[[10305] Card-Phone](https://hackmd.io/RFSxYF85Q0WqOd8I6Xenjg)
[[10405] Token-Phone](https://hackmd.io/hRrNYs3wQYeHChpNSk0AFg)
**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.
## XPAY Support
<details>
<summary>Contacts</summary>
</br>
Phone: +38 (096) 099 20 59
Email: info@xpay.com.ua
Telegram: @xpaysupportbot
</details>
</br>
:::info
**API navigation:**
:bookmark_tabs: [XPAY API Guide](https://hackmd.io/QA2NYRliRLGviJl5P4-ZCw)
:arrow_left: [General API Integration Information](https://hackmd.io/ijxPm0xtTpycgTjuU_NHQQ)
:::