> For the complete documentation index, see [llms.txt](https://docs.trybit.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.trybit.com/ru/api-reference-v2/create-invoice.md).

# Создание счета

Метод позволяет создать счет для клиента с помощью POST запроса.

### Что делает метод

* Создает уникальный invoice
* Возвращает ссылку или реквизиты для оплаты
* Позволяет передать дополнительные данные

### Endpoint

<mark style="color:green;">`POST`</mark> `https://api.trybit.com/v2/invoice/create`

### Headers

| Name                                            | Type   | Example                             | Description      |
| ----------------------------------------------- | ------ | ----------------------------------- | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Token eyJ0eXAiOiJK<...>4npi1ksS8tSY | API-ключ проекта |

### Request Body

Основные параметры

| Name                                       | Type   | Example           | Description                                                                                                                                                                                                                                                                                                                              |
| ------------------------------------------ | ------ | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| shop\_id<mark style="color:red;">\*</mark> | string | NGpD44<...>KXRdQ  | Уникальный идентификатор магазина из личного кабинета                                                                                                                                                                                                                                                                                    |
| amount<mark style="color:red;">\*</mark>   | float  | 100               | Сумма платежа в USD                                                                                                                                                                                                                                                                                                                      |
| currency<mark style="color:red;">\*</mark> | string | USD               | <p>Доступные валюты для конвертации: </p><p></p><p>USD, EUR, GBP, JPY, CNY, RUB, INR, AUD, CAD, SGD, HKD, TRY, AED, THB, MYR, PHP, IDR, VND, KZT, UAH, BYN, UZS, KGS, AMD, AZN, ARS, BOB, BRL, GYD, COP, PYG, PEN, SRD, UYU, CLP, BZD, GTQ, HNL, CRC, MXN, NIO, PAB, DOP, HTG. </p><p></p><p>По умолчанию устанавливается валюта USD</p> |
| order\_id                                  | string | ORDER\_93223      | Произвольный номер счета во внешней системе                                                                                                                                                                                                                                                                                              |
| email                                      | string | <email@gmail.com> | Email адрес плательщика                                                                                                                                                                                                                                                                                                                  |

Необязательные параметры

**add\_fields** — это объект для передачи дополнительных данных

| Name        | Type | Example                                                                     | Description              |
| ----------- | ---- | --------------------------------------------------------------------------- | ------------------------ |
| add\_fields | dict | <p>{time\_to\_pay: {</p><p> "hours": 24, "minutes": 0</p><p> },</p><p>}</p> | Дополнительные параметры |

{% hint style="warning" %}
Необязательные параметры должны передаваться внутри объекта **add\_fields**
{% endhint %}

| Name                  | Type          | Example                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------- | ------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| time\_to\_pay         | dict          | { "hours": 24, "minutes": 0 }    | Время жизни счета                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| available\_currencies | list\[string] | \[ "USDT\_TRC20", "ETH", "BTC" ] | <p>Доступные валюты для оплаты:</p><p></p><p>BTC, LTC, TRX, SOL, TON, BNB, ETH, ETH\_ARB, ETH\_BASE, ETH\_OPT, USDT\_ARB, USDT\_BSC, USDT\_ERC20, USDT\_OPT, USDT\_SOL, USDT\_TON, USDT\_TRC20, USDC\_ARB, USDC\_BASE, USDC\_BSC, USDC\_ERC20, USDC\_OPT, USDC\_SOL, DAI\_ARB, DAI\_BASE, DAI\_BSC, DAI\_ERC20, DAI\_OPT, USDD\_TRC20, PYUSD\_ERC20, PYUSD\_SOL, XAUT\_ERC20, XAUT\_TON, ARB\_ARB, OP\_OPT, PEPE\_BSC, PEPE\_ERC20, SHIB\_BSC, SHIB\_ERC20, TRUMP\_SOL</p> |
| cryptocurrency        | string        | ETH                              | <p>Выбор валюты оплаты за пользователя. </p><p></p><p>При указании валюты на странице оплаты будут отображаться реквизиты без выбора валюты. </p><p></p><p>Так же адрес и сумма будут выданы в ответе на запрос.</p>                                                                                                                                                                                                                                                       |

### Примеры запроса

Эти примеры показывают, как можно отправить запрос на создание счета. Обратите внимание, что необходимо предоставить ваш API ключ в заголовке `Authorization` для успешной авторизации запроса.

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

```bash
curl -X POST \
     -H "Authorization: Token <API KEY>" \
     -H "Content-Type: application/json" \
     -d '{"amount": 100, "shop_id": <SHOP_ID>, "currency": "USD"}' \
     "https://api.trybit.com/v2/invoice/create"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://api.trybit.com/v2/invoice/create"
headers = {
    "Authorization": "Token <API KEY>",
    "Content-Type": "application/json"
}

data = {
    "amount": 100,
    "shop_id": "xBAivfPIbskwuEWj",
    "currency": "USD"
}

response = requests.post(url, headers=headers, json=data)

if response.status_code == 200:
    print("Success:", response.json())
else:
    print("Fail:", response.status_code, response.text)
```

{% endtab %}

{% tab title="JavaScript " %}
{% code title="Fetch.js:" %}

```javascript
const url = 'https://api.trybit.com/v2/invoice/create';
const headers = new Headers({
    'Authorization': 'Token <API KEY>',
    'Content-Type': 'application/json'
});
const data = {
    amount: 100,
    shop_id: 'xBAivfPIbskwuEWj',
    currency: 'USD'
};

fetch(url, {
    method: 'POST',
    headers,
    body: JSON.stringify(data)
})
.then(response => {
    if (response.ok) {
        return response.json();
    } else {
        return Promise.reject('Creation Error');
    }
})
.then(data => {
    console.log('Success:', data);
})
.catch(error => {
    console.error('Fail:', error);
});
```

{% endcode %}

{% code title="Ajax.js:" %}

```javascript
$.ajax({
    url: 'https://api.trybit.com/v2/invoice/create',
    method: 'POST',
    headers: {
        'Authorization': 'Token <API KEY>',
        'Content-Type': 'application/json'
    },
    data: JSON.stringify({
        amount: 100,
        shop_id: 'xBAivfPIbskwuEWj',
        currency: 'USD'
    }),
    success: function(data) {
        console.log('Success:', data);
    },
    error: function(error) {
        console.error('Fail:', error);
    }
});
```

{% endcode %}

{% code title="Axios.js:" %}

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

const url = 'https://api.trybit.com/v2/invoice/create';
const headers = {
    'Authorization': 'Token <API KEY>',
    'Content-Type': 'application/json'
};
const data = {
    amount: 100,
    shop_id: 'xBAivfPIbskwuEWj',
    currency: 'USD'
};

axios.post(url, data, { headers })
    .then(response => {
        console.log('Success:', response.data);
    })
    .catch(error => {
        console.error('Fail:', error);
    });
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code title="cURL:" %}

```php
<?php
$url = "https://api.trybit.com/v2/invoice/create";
$headers = array(
    "Authorization: Token <API KEY>",
    "Content-Type: application/json"
);

$data = array(
    "amount" => 100,
    "shop_id" => "xBAivfPIbskwuEWj",
    "currency" => "USD"
);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

if($http_code == 200){
    echo "Success: " . $response;
} else {
    echo "Fail: " . $http_code . " " . $response;
}

curl_close($ch);
?>
```

{% endcode %}

{% code title="File\_get\_contents:" %}

```php
<?php
$url = "https://api.trybit.com/v2/invoice/create";
$headers = array(
    "http" => array(
        "header" => "Authorization: Token <API KEY>\r\n" .
                    "Content-Type: application/json\r\n",
        "method" => "POST",
        "content" => json_encode(array(
            "amount" => 100,
            "shop_id" => "xBAivfPIbskwuEWj",
            "currency" => "USD"
        )),
    ),
);

$context  = stream_context_create($headers);
$response = file_get_contents($url, false, $context);
$http_code = $http_response_header[0];

if(strpos($http_code, "200")){
    echo "Success: " . $response;
} else {
    echo "Fail: " . $http_code . " " . $response;
}
?>
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Пример ответа

На успешный запрос приходит ответ со статусом `success` и объектом `result`.

{% tabs %}
{% tab title="200: ОК – Invoice created" %}

```json
{
    "status": "success",
    "result": {
        "uuid": "INV-89UX09KA",
        "created": "2026-01-27 09:03:58.958133",
        "address": "0xb07427fc721C23674c48233ffE93D3846ee58B63",
        "expiry_date": "2026-01-28 09:03:57.493361",
        "side_commission": "client",
        "side_commission_service": "merchant",
        "type_payments": "crypto",
        "amount": 0.034187,
        "amount_usd": 100.0,
        "amount_in_fiat": 100.0,
        "fee": 1.499999996212864e-06,
        "fee_usd": 0.0,
        "service_fee": 0.00065,
        "service_fee_usd": 1.9,
        "fiat_currency": "USD",
        "status": "created",
        "is_email_required": false,
        "link": "https://pay.trybit.com/89UX09KA",
        "invoice_id": null,
        "currency": {
            "id": 3,
            "code": "ETH",
            "fullcode": "ETH",
            "network": {
                "code": "ERC20",
                "id": 3,
                "icon": "https://cdn.trybit.com/img/network/ERC.svg",
                "fullname": "Ethereum"
            },
            "name": "Ethereum",
            "is_email_required": false,
            "stablecoin": false,
            "icon_base": "https://cdn.trybit.com/img/currency/ETH.svg",
            "icon_network": "https://cdn.trybit.com/img/currency/ETH.svg",
            "icon_qr": "https://cdn.trybit.com/img/stroke/ETH_STROKE.svg",
            "order": 9
        },
        "project": {
            "id": 1,
            "name": "Test",
            "fail": "https://test.com/failed-payment",
            "success": "https://test.com/successful-payment",
            "logo": "https://static.trybit.com/logo/L52hWwjt98uYtUF91765782359.174416.jpg"
        },
        "test_mode": false
    }
}

```

{% endtab %}
{% endtabs %}

### Параметры ответа

Объект result содержит:

| Name                 | Type   | Example                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Description                                                                                                                                                                                                                                                                           |
| -------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| uuid                 | string | INV-89UX09KA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Уникальный идентификатор счета с префиксом INV                                                                                                                                                                                                                                        |
| created              | string | 2026-01-01 12:00:00.000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Время создания счета по UTC +0 в формате YYYY-MM-DD HH:MI:SS.FFFFFF                                                                                                                                                                                                                   |
| address              | string | 0xb07427<...>E93D3846ee58B63                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | <p>Адрес для оплаты<br></p><p>Будет предзаполнен только в случае выбора криптовалюты для оплаты<br></p><p>Для выбора валюты за клиента необходимо в <code>add\_fields.cryptocurrency</code> указать доступную в проекте валюту</p>                                                    |
| expiry\_date         | string | 2026-01-02 12:00:00.000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | <p>Дата истечения срока действия счета по UTC +0 в формате YYYY-MM-DD HH:MI:SS.FFFFFF<br></p><p>После истечения срока действия счет переведется в статус <code>canceled</code>,  если оплата не поступила</p>                                                                         |
| side\_commission     | string | client                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Сторона оплаты трансферной комиссии                                                                                                                                                                                                                                                   |
| side\_commission\_cc | string | client                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Сторона оплаты комиссии сервиса                                                                                                                                                                                                                                                       |
| amount               | float  | 0.033366                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Сумма счета в выбранной криптовалюте                                                                                                                                                                                                                                                  |
| amount\_usd          | float  | 100.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Сумма счета в USD                                                                                                                                                                                                                                                                     |
| amount\_in\_fiat     | float  | 100.0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Сумма счета в валюте создания (зависит от параметра `currency`)                                                                                                                                                                                                                       |
| fee                  | float  | 4.500000159168849e-06                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Трансферная комиссия счета                                                                                                                                                                                                                                                            |
| fee\_usd             | float  | 0.01                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Трансферная комиссия счета в USD                                                                                                                                                                                                                                                      |
| service\_fee         | float  | 0.000634                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Комиссия сервиса                                                                                                                                                                                                                                                                      |
| service\_fee\_usd    | float  | 1.9                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Комиссия сервиса в USD                                                                                                                                                                                                                                                                |
| fiat\_currency       | string | USD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Код фиатной валюты, в которой был создан счет                                                                                                                                                                                                                                         |
| status               | string | created                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | <p>Статус счета <br></p><p>При отправке запроса на создание счета всегда равен <code>created</code>. </p><p></p><p>Так же есть статусы <code>paid</code> (оплачен), <code>partial</code> (оплачен частично), <code>overpaid</code> (переплачен) и <code>canceled</code> (отменен)</p> |
| is\_email\_required  | bool   | false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Параметр для обязательного заполнения почты в счете                                                                                                                                                                                                                                   |
| link                 | string | pay.trybit.com/89UX09KA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Ссылка на страницу счета                                                                                                                                                                                                                                                              |
| currency             | dict   | <p>"currency": {</p><p>            "id": 3,</p><p>            "code": "ETH",</p><p>            "fullcode": "ETH",</p><p>            "network": {</p><p>                "code": "ERC20",</p><p>                "id": 3,</p><p>                "icon": "<https://cdn.trybit.com/img/network/ERC.svg>",</p><p>                "fullname": "Ethereum"</p><p>            },</p><p>            "name": "Ethereum",</p><p>            "is\_email\_required": false,</p><p>            "stablecoin": false,</p><p>            "icon\_base": "<https://cdn.trybit.com/img/currency/ETH.svg>",</p><p>            "icon\_network": "<https://cdn.trybit.com/img/currency/ETH.svg>",</p><p>            "icon\_qr": "<https://cdn.trybit.com/img/stroke/ETH_STROKE.svg>",</p><p>            "order": 9</p><p>        }</p> | <p>Объект выбранной криптовалюты в счете. </p><p><br></p><p>Так же содержит объект <code>network</code> — информация о выбранной сети валюты</p>                                                                                                                                      |
| project              | dict   | <p>"project": {</p><p>            "id": 0,</p><p>            "name": "MyShop",</p><p>            "fail": "<https://test.com/failed-payment>",</p><p>            "success": "<https://test.com/successful-payment>",</p><p>            "logo": "<https://static.trybit.com/logo/logo.jpg>"</p><p>        }</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Объект с информацией о проекте                                                                                                                                                                                                                                                        |
| test\_mode           | bool   | false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Признак тестового счета                                                                                                                                                                                                                                                               |

> Мы регулярно работаем над улучшением документации сервиса для разработчиков. Пожалуйста, оцените качество и полезность материалов [по ссылке](https://survey.zohopublic.eu/zs/G6TdRh).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.trybit.com/ru/api-reference-v2/create-invoice.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
