> For the complete documentation index, see [llms.txt](https://docs.xpayconnect.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xpayconnect.io/documentation/eng/orders/payout.md).

# Create Payout (PAYOUT)

> Method: **POST**
>
> Path: **/merchant/createOrder**

## Request Parameters

```json
{
    "order_id": "01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a",
    "amount": 23000,
    "type": "sim",
    "success_callback_url": "http://test.com/api/order/success",
    "merchant_id": "exMerchant",
    "client_id": "99999999",
    "direction": "PAYOUT",
    "payout_details": {
        "holderAccount": "79030000000",
        "holderName": "Имя Фамилия",
        "methodName": "Альфа Банк"
    }
}
```

| Field                      | Type          | Required | Description                                                                                                                                                                                                     |
| -------------------------- | ------------- | :------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **amount**                 | integer       |     ✓    | Payout amount in RUB (gross, before merchant fee deduction). The merchant's balance will be charged `amount` plus the processing fee — see `amountAfterFee` in the response for the exact amount to be deducted |
| **type**                   | string (enum) |     ✓    | **card** — card payout; **sim** — SBP payout                                                                                                                                                                    |
| **merchant\_id**           | string        |     ✓    | Unique merchant name                                                                                                                                                                                            |
| **direction**              | string (enum) |     ✓    | Required for payouts: value `PAYOUT`                                                                                                                                                                            |
| **payout\_details**        | object        |     ✓    | Object with transfer details                                                                                                                                                                                    |
| ↳ **holderAccount**        | string        |     ✓    | Transfer requisite — digits only, no `+`. 11 digits for SBP, 16 digits for C2C                                                                                                                                  |
| ↳ **holderName**           | string        |     ✓    | Name of the requisite holder                                                                                                                                                                                    |
| ↳ **methodName**           | string (enum) |     ✓    | Bank for the transfer. Values from the [bank list](#spisok-bankov-dlya-vyplat-sbp)                                                                                                                              |
| **order\_id**              | string        |     —    | Unique identifier on the merchant's side (external\_id). We recommend a UUID (v4 or v7) to guarantee uniqueness                                                                                                 |
| **success\_callback\_url** | string        |     —    | Merchant URL for receiving the webhook when the payout completes                                                                                                                                                |
| **client\_id**             | string        |     —    | Client ID in the merchant's system                                                                                                                                                                              |

### Request Examples

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const crypto = require('crypto');
const axios = require('axios');

const apiKey = 'YOUR_API_KEY';
const body = {
    order_id: '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    amount: 23000,
    type: 'sim',
    success_callback_url: 'http://test.com/api/order/success',
    merchant_id: 'exMerchant',
    client_id: '99999999',
    direction: 'PAYOUT',
    payout_details: {
        holderAccount: '79030000000',
        holderName: 'Имя Фамилия',
        methodName: 'Альфа Банк',
    },
};

const bodyStr = JSON.stringify(body);
const xApiKey = crypto.createHash('sha256').update(`${apiKey}|${bodyStr}`).digest('hex');

const { data } = await axios.post('https://api.xpayconnect.io/merchant/createOrder', body, {
    headers: {
        'Content-Type': 'application/json',
        'client-api-key': apiKey,
        'x-api-key': xApiKey,
    },
});
```

{% endtab %}

{% tab title="Python" %}

```python
import hashlib
import json
import requests

api_key = 'YOUR_API_KEY'
body = {
    'order_id': '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    'amount': 23000,
    'type': 'sim',
    'success_callback_url': 'http://test.com/api/order/success',
    'merchant_id': 'exMerchant',
    'client_id': '99999999',
    'direction': 'PAYOUT',
    'payout_details': {
        'holderAccount': '79030000000',
        'holderName': 'Имя Фамилия',
        'methodName': 'Альфа Банк',
    },
}

body_str = json.dumps(body, separators=(',', ':'))
x_api_key = hashlib.sha256(f'{api_key}|{body_str}'.encode()).hexdigest()

resp = requests.post('https://api.xpayconnect.io/merchant/createOrder', json=body, headers={
    'Content-Type': 'application/json',
    'client-api-key': api_key,
    'x-api-key': x_api_key,
})
data = resp.json()
```

{% endtab %}

{% tab title="PHP" %}

```php
$apiKey = 'YOUR_API_KEY';
$body = [
    'order_id' => '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    'amount' => 23000,
    'type' => 'sim',
    'success_callback_url' => 'http://test.com/api/order/success',
    'merchant_id' => 'exMerchant',
    'client_id' => '99999999',
    'direction' => 'PAYOUT',
    'payout_details' => [
        'holderAccount' => '79030000000',
        'holderName' => 'Имя Фамилия',
        'methodName' => 'Альфа Банк',
    ],
];

$bodyStr = json_encode($body, JSON_UNESCAPED_UNICODE);
$xApiKey = hash('sha256', $apiKey . '|' . $bodyStr);

$ch = curl_init('https://api.xpayconnect.io/merchant/createOrder');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $bodyStr,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'client-api-key: ' . $apiKey,
        'x-api-key: ' . $xApiKey,
    ],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
```

{% endtab %}
{% endtabs %}

***

## Response

```json
{
    "ok": true,
    "id": "lux01993328-a828-7581-b3a9-e712a6a0e88c",
    "payment_id": "01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a",
    "status": "pending",
    "direction": "PAYOUT",
    "currency": "RUB",
    "amountAfterFee": 22540,
    "payment_details": {
        "address": "79030000000",
        "bank": "Альфа Банк",
        "holder_name": "Имя Фамилия",
        "type": "sim",
        "amount": "23000"
    }
}
```

| Field                | Type          | Description                                                                                                                                                    |
| -------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **ok**               | boolean       | `true` when requisites are successfully provided                                                                                                               |
| **id**               | string (uuid) | Unique identifier in the internal system (internal\_id)                                                                                                        |
| **payment\_id**      | string        | The **order\_id** passed by the merchant at creation, or system-generated if `null` was passed                                                                 |
| **status**           | string (enum) | Payment status: `pending`, `success`, `error`                                                                                                                  |
| **direction**        | string (enum) | `PAYOUT` for payouts                                                                                                                                           |
| **currency**         | string        | Order currency (for PAYOUT — `RUB`)                                                                                                                            |
| **amountAfterFee**   | number        | Amount in fiat currency after deducting the merchant's payout fee. Fixed at order creation; on success — the actual amount debited from the merchant's balance |
| **payment\_details** | object        | Information about the provided requisites                                                                                                                      |
| ↳ **address**        | string        | Transfer requisites                                                                                                                                            |
| ↳ **bank**           | string        | Bank name                                                                                                                                                      |
| ↳ **holder\_name**   | string        | Name of the requisite holder                                                                                                                                   |
| ↳ **type**           | string (enum) | [Payment method for payouts](#platezhnye-metody-dlya-vyplat)                                                                                                   |
| ↳ **amount**         | string        | Payout amount in RUB (gross, before fee deduction)                                                                                                             |

{% hint style="info" %}
USDT conversion (`convertToUsdt`) is **not supported** for payouts — the fields `usdtAmount`, `usdtAmountAfterFee`, `exchangeRate` are always absent in PAYOUT responses. The payout fee is configured individually per merchant.
{% endhint %}

***

## Payment Methods for Payouts

| Method   | Description       |
| -------- | ----------------- |
| **card** | Russian bank card |
| **sim**  | Russian SBP       |

***

## Bank List for SBP Payouts

> Method: **GET**
>
> Path: **/merchant/banks**

Returns the list of banks supported for SBP payouts. The `name` value from the response is passed to `payout_details.methodName` when creating a payout.

### Request Example

{% tabs %}
{% tab title="cURL" %}

```bash
curl https://api.xpayconnect.io/merchant/banks \
  -H "client-api-key: YOUR_API_KEY" \
  -H "x-api-key: $(printf '%s|' YOUR_API_KEY | sha256sum | awk '{print $1}')"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const crypto = require('crypto');
const axios = require('axios');

const apiKey = 'YOUR_API_KEY';
const xApiKey = crypto.createHash('sha256').update(`${apiKey}|`).digest('hex');

const { data } = await axios.get('https://api.xpayconnect.io/merchant/banks', {
    headers: { 'client-api-key': apiKey, 'x-api-key': xApiKey },
});
console.log(data.count, data.data);
```

{% endtab %}

{% tab title="Python" %}

```python
import hashlib
import requests

api_key = 'YOUR_API_KEY'
x_api_key = hashlib.sha256(f'{api_key}|'.encode()).hexdigest()

resp = requests.get('https://api.xpayconnect.io/merchant/banks', headers={
    'client-api-key': api_key,
    'x-api-key': x_api_key,
})
data = resp.json()
print(data['count'], data['data'])
```

{% endtab %}
{% endtabs %}

### Response

```json
{
  "success": true,
  "count": 2,
  "data": [
    { "code": "ALFA_BANK", "name": "Альфа Банк" },
    { "code": "SBER", "name": "Сбербанк" }
  ]
}
```

| Field       | Type    | Description                                      |
| ----------- | ------- | ------------------------------------------------ |
| **success** | boolean | Indicates a successful response                  |
| **count**   | number  | Number of banks in the response                  |
| **data**    | array   | List of banks                                    |
| ↳ **code**  | string  | Internal bank identifier                         |
| ↳ **name**  | string  | Bank name to pass in `payout_details.methodName` |
