# Создание инвойса

## Создание инвойса

<mark style="color:green;">`POST`</mark> `https://api.crystalpay.io/v3/invoice/create/`

**Body**

<table><thead><tr><th>Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>auth_login</code><mark style="color:red;">*</mark></td><td>string</td><td>Логин кассы</td></tr><tr><td><code>auth_secret</code><mark style="color:red;">*</mark></td><td>string</td><td>Секретный ключ кассы</td></tr><tr><td><code>amount</code><mark style="color:red;">*</mark></td><td>number</td><td>Сумма инвойса</td></tr><tr><td><code>type</code><mark style="color:red;">*</mark></td><td>string</td><td><a href="/pages/Mv5o7r4FFtKNX3iUXgT3#vozmozhnye-varianty-type">Тип инвойса</a></td></tr><tr><td><code>lifetime</code><mark style="color:red;">*</mark></td><td>number</td><td>Время жизни инвойса в минутах</td></tr><tr><td><code>currency</code> <sup>(ранее <code>amount_currency</code>)</sup></td><td>string</td><td>Валюта инвойса, по умолчанию RUB</td></tr><tr><td><code>subtract_from</code></td><td>string</td><td><a href="/pages/Mv5o7r4FFtKNX3iUXgT3#vozmozhnye-varianty-subtract_from">Откуда вычитать комиссию, по умолчанию amount</a></td></tr><tr><td><code>required_method</code></td><td>string</td><td>Заранее заданный метод, плательщик не сможет выбрать другой</td></tr><tr><td><code>payer_details</code></td><td>array</td><td><a href="/pages/Mv5o7r4FFtKNX3iUXgT3#vozmozhnye-znacheniya-payer_details">Связанная с плательщиком информация - Email и т.п</a></td></tr><tr><td><code>description</code></td><td>string</td><td>Описание или назначение</td></tr><tr><td><code>extra</code></td><td>string</td><td>Любые данные, например ID платежа в вашей системе</td></tr><tr><td><code>redirect_url</code></td><td>string</td><td>Ссылка для перенаправления после оплаты</td></tr><tr><td><code>callback_url</code></td><td>string</td><td><a href="/pages/bPe8HUhLvdYJhOrfbAjc">Ссылка для отправки http callback уведомления об оплате</a></td></tr></tbody></table>

<mark style="color:red;">\*</mark> *- обязательные поля*

**Response**

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

```json
{
    "error": false,
    "errors": [],
    "id": "123456789_abcdefghij",
    "url": "https://pay.crystalpay.io/?i=123456789_abcdefghij",
    "rub_amount": "8146",
    "currency": "USD",
    "amount": "100",
    "type": "topup",
    "subtract_from": "amount"
}
```

{% endtab %}

{% tab title="Описание полей" %}

<table><thead><tr><th>Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>string</td><td>ID инвойса</td></tr><tr><td><code>url</code></td><td>string</td><td>Ссылка на оплату инвойса</td></tr><tr><td><code>rub_amount</code></td><td>string</td><td>Сумма инвойса в рублях</td></tr><tr><td><code>currency</code></td><td>string</td><td>Валюта инвойса</td></tr><tr><td><code>amount</code></td><td>string</td><td>Сумма инвойса в валюте <code>currency</code></td></tr><tr><td><code>type</code></td><td>string</td><td><a href="/pages/Mv5o7r4FFtKNX3iUXgT3#vozmozhnye-varianty-type">Тип инвойса</a></td></tr><tr><td><code>subtract_from</code></td><td>string</td><td><a href="/pages/Mv5o7r4FFtKNX3iUXgT3#vozmozhnye-varianty-subtract_from">Откуда вычитать комиссию</a></td></tr></tbody></table>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.crystalpay.io/metody-api/invoice-platezhi/sozdanie-invoisa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
