> For the complete documentation index, see [llms.txt](https://just-trade.gitbook.io/just-trade-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://just-trade.gitbook.io/just-trade-docs/scheta/sozdanie-kripto-scheta.md).

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

#### POST /invoices

Создаёт новый счёт для оплаты в криптовалюте или фиате.

**Запрос**

**URL**: <https://pay.just-trade.ru/invoices\\>
**Метод**: POST\
**Заголовки**:

* Authorization: Bearer \<token>
* Content-Type: application/json

**Тело запроса**:

```json
{
  "currency_type": "crypto",
  "base_asset": "BTC",
  "accepted_asset": ["BTC", "ETH"],
  "amount": 0.01,
  "description": "Оплата заказа #123",
  "expires_in": 3600,
  "webhook_data": { "order_id": "123" }
}
```

**Параметры тела**:

| Параметр        | Тип     | Описание                                                                           |
| --------------- | ------- | ---------------------------------------------------------------------------------- |
| currency\_type  | string  | Обязательный. crypto или fiat.                                                     |
| base\_asset     | string  | Обязательный, если currency\_type = crypto. Код криптовалюты (макс. 10 символов).  |
| accepted\_asset | array   | Обязательный. Массив кодов криптовалют (1–10 элементов, макс. 10 символов каждый). |
| fiat            | string  | Обязательный, если currency\_type = fiat. Код фиатной валюты (макс. 10 символов).  |
| amount          | float   | Обязательный. Сумма счета (0.01–10000000000000).                                   |
| description     | string  | Необязательный. Описание счета (макс. 500 символов).                               |
| expires\_in     | integer | Необязательный. Время действия счета в секундах (мин. 60).                         |
| webhook\_data   | object  | Необязательный. Данные для вебхуков (макс. 1KB).                                   |

**Пример запроса на Python**:

```bash
import aiohttp
import asyncio

async def create_invoice():
    url = "https://pay.just-trade.ru/invoices"
    headers = {
        "Authorization": "Bearer your_token_here",
        "Content-Type": "application/json"
    }
    data = {
        "currency_type": "crypto",
        "base_asset": "BTC",
        "accepted_asset": ["BTC", "ETH"],
        "amount": 0.01,
        "description": "Оплата заказа #123",
        "expires_in": 3600,
        "webhook_data": {"order_id": "123"}
    }

    async with aiohttp.ClientSession() as session:
        async with session.post(url, headers=headers, json=data) as response:
            if response.status == 200:
                data = await response.json()
                print(data)
            else:
                error = await response.json()
                print(f"Ошибка: {response.status}, {error}")
```

**Ответ**

**Статус**: 200 OK\
**Тело ответа**:

```json
{
  "invoice_id": "app_invoice_1a2b3c4d5e6f7890",
  "link": "https://t.me/bot?start=app_invoice_1a2b3c4d5e6f7890",
  "amount": 0.01,
  "currency_type": "crypto"
}
```

**Ошибки**

* 400 Bad Request: Неверные параметры (например, base\_asset не в accepted\_asset).
* 401 Unauthorized: Неверный или отсутствующий токен.
* 500 Internal Server Error: Ошибка сервера.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://just-trade.gitbook.io/just-trade-docs/scheta/sozdanie-kripto-scheta.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
