> 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/requisite-pool.md).

# Requisite Pool

The requisite pool is a mechanism that allows a merchant to pre-fetch a list of available requisites and create an order bound to a specific requisite. This speeds up issuing requisites to the client.

***

## Fetching the Pool

> Method: **GET**
>
> Path: **/merchant/pool/requisites**

Returns a list of requisites currently available for order creation.

{% tabs %}
{% 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/pool/requisites', {
    headers: { 'client-api-key': apiKey, 'x-api-key': xApiKey },
});
```

{% 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/pool/requisites', headers={
    'client-api-key': api_key,
    'x-api-key': x_api_key,
})
data = resp.json()
```

{% endtab %}

{% tab title="PHP" %}

```php
$apiKey = 'YOUR_API_KEY';
$xApiKey = hash('sha256', $apiKey . '|');

$ch = curl_init('https://api.xpayconnect.io/merchant/pool/requisites');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['client-api-key: ' . $apiKey, 'x-api-key: ' . $xApiKey],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
```

{% endtab %}
{% endtabs %}

### Response

```json
{
    "success": true,
    "data": [
        { "id": 9319, "amount": 2300, "type": "sim", "remainingSeconds": 847 },
        { "id": 9322, "amount": 2500, "type": "card", "remainingSeconds": 614 }
    ]
}
```

| Field                  | Type          | Description                                                             |
| ---------------------- | ------------- | ----------------------------------------------------------------------- |
| **success**            | boolean       | `true` on successful pool retrieval                                     |
| **data**               | array         | List of available requisites                                            |
| ↳ **id**               | number        | Unique identifier of the requisite in the pool                          |
| ↳ **amount**           | number        | Amount assigned to the requisite (in RUB)                               |
| ↳ **type**             | string (enum) | [Payment method](/documentation/eng/orders/create.md#platezhnye-metody) |
| ↳ **remainingSeconds** | number        | Time in seconds during which the requisite remains reserved in the pool |

***

## Creating an Order from the Pool

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

Creates an order using a specific requisite from the pool. Pass `usePool: true` and the `requisiteId` obtained in the previous step.

{% tabs %}
{% 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.post('https://api.xpayconnect.io/merchant/createOrder', {
    order_id: '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    usePool: true,
    requisiteId: 9319,
    success_callback_url: 'https://merchant.com/callback',
    merchant_id: 'exMerchant',
    client_id: '99999999',
    currency: 'RUB',
    convertToUsdt: false,
}, {
    headers: { 'client-api-key': apiKey, 'x-api-key': xApiKey },
});
```

{% 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.post('https://api.xpayconnect.io/merchant/createOrder', json={
    'order_id': '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    'usePool': True,
    'requisiteId': 9319,
    'success_callback_url': 'https://merchant.com/callback',
    'merchant_id': 'exMerchant',
    'client_id': '99999999',
    'currency': 'RUB',
    'convertToUsdt': False,
}, headers={
    'client-api-key': api_key,
    'x-api-key': x_api_key,
})
data = resp.json()
```

{% endtab %}

{% tab title="PHP" %}

```php
$apiKey = 'YOUR_API_KEY';
$xApiKey = hash('sha256', $apiKey . '|');

$body = json_encode([
    'order_id' => '01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a',
    'usePool' => true,
    'requisiteId' => 9319,
    'success_callback_url' => 'https://merchant.com/callback',
    'merchant_id' => 'exMerchant',
    'client_id' => '99999999',
    'currency' => 'RUB',
    'convertToUsdt' => false,
]);

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

{% endtab %}
{% endtabs %}

### Request Body

```json
{
    "order_id": "01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a",
    "usePool": true,
    "requisiteId": 9319,
    "success_callback_url": "https://merchant.com/callback",
    "merchant_id": "exMerchant",
    "client_id": "99999999",
    "currency": "RUB",
    "convertToUsdt": false
}
```

| Field                      | Type          | Required | Description                                                                                                     |
| -------------------------- | ------------- | :------: | --------------------------------------------------------------------------------------------------------------- |
| **usePool**                | boolean       |     ✓    | `true` — use a requisite from the pool instead of standard requisite assignment                                 |
| **requisiteId**            | number        |     ✓    | Requisite ID from the pool (the `id` field in the pool fetch response)                                          |
| **merchant\_id**           | string        |     ✓    | Unique merchant name                                                                                            |
| **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        |     —    | URL for receiving a webhook upon payment completion                                                             |
| **client\_id**             | string        |     —    | Client ID in the merchant's system                                                                              |
| **currency**               | string (enum) |     —    | Order currency. Must match the merchant's currency. Defaults to `RUB`                                           |
| **convertToUsdt**          | boolean       |     —    | Convert the credited amount to USDT. Requires administrator permission. Defaults to `false`                     |

### Response

```json
{
    "ok": true,
    "id": "lux01993328-a828-7581-b3a9-e712a6a0e88c",
    "payment_id": "01a00c1a-9f0e-7e42-b8a5-2a1c3d4e5f6a",
    "status": "pending",
    "usdtAmount": 25.5,
    "exchangeRate": 78.3,
    "currency": "RUB",
    "remainingSeconds": 800,
    "payment_details": {
        "address": "+79221110500",
        "bank": "Сбербанк",
        "holder_name": "Имя Фамилия",
        "type": "sim",
        "amount": "2300"
    }
}
```

| Field                | Type          | Description                                                                               |
| -------------------- | ------------- | ----------------------------------------------------------------------------------------- |
| **ok**               | boolean       | `true` on successful order creation                                                       |
| **id**               | string (uuid) | Unique order identifier in the internal system (internal\_id)                             |
| **payment\_id**      | string        | Identifier provided by the merchant, or system-generated when `null`                      |
| **status**           | string        | Payment status                                                                            |
| **usdtAmount**       | number, null  | Calculated amount in USDT (only when `convertToUsdt: true`)                               |
| **exchangeRate**     | number, null  | Locked USDT/RUB exchange rate                                                             |
| **currency**         | string        | Order currency                                                                            |
| **remainingSeconds** | number        | Remaining time to complete payment in seconds. After expiry the requisites become invalid |
| **payment\_details** | object        | Information about the issued requisites                                                   |
| ↳ **address**        | string        | Requisite for making the payment (card number, phone number, etc.)                        |
| ↳ **bank**           | string        | Bank name                                                                                 |
| ↳ **holder\_name**   | string        | Requisite holder name                                                                     |
| ↳ **type**           | string (enum) | [Payment method](/documentation/eng/orders/create.md#platezhnye-metody)                   |
| ↳ **amount**         | string        | Amount to pay in RUB                                                                      |
