# Конвертация и перевод средств между различными сетями (Мост)

## Конвертация Coin/Coin

Конвертация на сумму `amountIn` из валюты `assetCodeIn` в валюту `assetCodeOut`.\
Система поддерживает два режима приоритета:

* `exchangePriority: "in"` - фиксируется сумма входа (`amountIn`)
* `exchangePriority: "out"` - фиксируется сумма выхода (`amountOut`)

**Правила валидации полей (важно):**

* Если `exchangePriority = "in"`, поле `amountIn` **обязательно**, а `amountOut` вычисляется автоматически по персональному курсу мерчанта.
* Если `exchangePriority = "out"`, поле `amountOut` **обязательно**, а `amountIn` рассчитывается системой.
* **Нельзя указывать оба поля одновременно как фиксированные**, приоритет определяет, какое из них фиксируется вручную, а какое рассчитывается.

**Курсы и тарифы**

Курс определяется индивидуально по тарифу, установленному мерчанту. Все расчёты производятся системой в момент проведения заявки.

## Создание обмена

> &#x20;   Конвертация на сумму amountIn в валюте assetCodeIn в валюту assetCodeOut.\
> &#x20;   Система поддерживает два режима приоритета:\
> &#x20;     exchangePriority: "in" - фиксируется сумма входа (amountIn)\
> &#x20;     exchangePriority: "out" - фиксируется сумма выхода (amountOut)\
> &#x20;  &#x20;

```json
{"openapi":"3.0.0","info":{"title":"Интеграция API","version":"0.0.4.1-alpha"},"tags":[{"name":"api","description":""}],"paths":{"/api/v1/integration/orders/exchange":{"post":{"operationId":"ApiOrderController_createExchange","summary":"Создание обмена","description":"    Конвертация на сумму amountIn в валюте assetCodeIn в валюту assetCodeOut.\n    Система поддерживает два режима приоритета:\n      exchangePriority: \"in\" - фиксируется сумма входа (amountIn)\n      exchangePriority: \"out\" - фиксируется сумма выхода (amountOut)\n    ","parameters":[{"name":"x-api-key","in":"header","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeDto"}}}},"responses":{"200":{"description":"Успешное создание обмена","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/AResponseType"},{"properties":{"data":{"$ref":"#/components/schemas/OrderSerializer"}}}]}}}},"400":{"description":"Некорректный запрос","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomBadRequestException"}}}},"401":{"description":"Необходимо авторизоваться для запроса","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomUnauthorizedException"}}}},"403":{"description":"Недостаточно прав","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomForbiddenException"}}}},"500":{"description":"Системная ошибка","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomInternalErrorException"}}}}},"tags":["api"]}}},"components":{"schemas":{"ExchangeDto":{"type":"object","properties":{"assetCodeIn":{"type":"string","description":"Ассет на входе в обмен"},"amountIn":{"type":"number","description":"Обмениваемая сумма (обязательно если exchangePriority=in)"},"assetCodeOut":{"type":"string","description":"Ассет на выходе"},"amountOut":{"type":"number","description":"Ожидаемая сумма (обязательно если exchangePriority=out)"},"comment":{"type":"string","description":"Комментарий к обмену. Опциональное поле"},"exchangePriority":{"type":"string","description":"Приоритет обмена (по дефолту \"in\")"},"idempotencyKey":{"type":"string","description":"Ключ идемпотентности для предотвращения дублирования заявок при сетевых разрывах и состоянии гонки. Должен быть уникальным для каждого мерчанта.","maxLength":255}},"required":["assetCodeIn","assetCodeOut"]},"AResponseType":{"type":"object","properties":{"message":{"type":"string","description":"Сообщение статуса"},"data":{"type":"object","description":"Данные"},"count":{"type":"number","description":"Общее кол-во элементов в БД"}},"required":["message"]},"OrderSerializer":{"type":"object","properties":{"id":{"type":"number","description":"Id"},"uid":{"type":"string","description":"UUID"},"createdAt":{"format":"date-time","type":"string","description":"Дата создания"},"updatedAt":{"format":"date-time","type":"string","description":"Дата обновления"},"deletedAt":{"format":"date-time","type":"string","description":"Дата удаления"},"serviceCommission":{"type":"string","description":"Комиссия сервиса"},"netCommission":{"type":"string","description":"Комиссия сети"},"comment":{"type":"string","description":"Комментарий"},"publicComment":{"type":"string","description":"Публичный комментарий"},"merchantUid":{"type":"string","description":"UUID мерчанта"},"merchantName":{"type":"string","description":"Имя мерчанта"},"merchantId":{"type":"string","description":"ID мерчанта"},"type":{"type":"string","description":"Тип заявки","enum":["deposit","invoice","invoice-without-amount","payment","payment-without-amount","exchange","withdraw","withdraw-with-exchange","account-transfer","currency-to-currency","account-deposit","ref-payment"]},"status":{"type":"string","description":"Статус заявки","enum":["created","success","warning","failed","inProgress","invoiceWaitCreate","invoiceNotCreated","invoiceWaitRequisites","invoiceWaitPay","invoiceWaitConfirms","invoiceWaitCheck","invoiceNotPayed","invoiceCheckBlocked","transferBlocked","exchangeBlocked","withdrawBlocked","waitRefundRequisites","waitRefundRequisitesCheck","waitToRefund","refunded","revoked"]},"invoiceCurrencyCode":{"type":"string","description":"Валюта, в которой выставлен инвойс"},"currencyInCode":{"type":"string","description":"Валюта оплаты"},"currencyOutCode":{"type":"string","description":"Получаемая валюта"},"invoiceAmount":{"type":"string","description":"Сумма инвойса"},"amountInExpected":{"type":"string","description":"Ожидаемая сумма оплаты"},"amountInFact":{"type":"string","description":"Фактическая сумма оплаты"},"amountOutExpected":{"type":"string","description":"Ожидаемая получаемая сумма"},"amountOutFact":{"type":"string","description":"Фактическая получаемая сумма"},"hedgeRate":{"type":"string","description":"Курс хеджирования"},"isDone":{"type":"boolean","description":"Заявка завершена?"},"apiMode":{"type":"string","description":"Источник создания заявки (UI | API)","enum":["ui","api","gateway"]},"risk":{"type":"string","description":"Оценка риска"},"requisites":{"type":"string","description":"Реквизиты заявки"},"requisitesIn":{"type":"string","description":"Реквизиты заявки вход"},"requisitesOut":{"type":"string","description":"Реквизиты заявки выход"},"requisitesMemoTag":{"type":"string","description":"Мемо тег (для XRP, TON и т.д.)"},"requisitesMemoTagIn":{"type":"string","description":"Мемо тег вход (для XRP, TON и т.д.)"},"requisitesMemoTagOut":{"type":"string","description":"Мемо тег выход (для XRP, TON и т.д.)"},"billingTag":{"type":"string","description":"Биллинг тэг"},"requisitesQrCode":{"type":"string","description":"Ссылка на QR с реквизитами"},"assetInCode":{"type":"string","description":"Входящий ассет"},"assetOutCode":{"type":"string","description":"Исходящий ассет"},"networkInCode":{"type":"string","description":"Входящяя сеть ассета"},"networkOutCode":{"type":"string","description":"Исходящяя сеть ассета"},"balanceAfter":{"type":"string","description":"Баланс после завершения заявки"},"balanceAccountAfter":{"type":"string","description":"Баланс после завершения заявки в ledger"},"callbackUrl":{"type":"string","description":"Колбэк урл"},"invoicePublicUrl":{"type":"string","description":"Публичный урл инвойса"},"txId":{"type":"string","description":"Айди транзакции"},"refundTxId":{"type":"string","description":"Айди транзакции возврата"},"expirationTime":{"format":"date-time","type":"string","description":"Оплатить до"},"isImPayed":{"type":"boolean","description":"Нажал оплатил?"},"isBayerPaysService":{"type":"boolean","description":"Покупатель оплачивает сервисную комиссию инвойсов?"},"serviceFeeCurrencyCode":{"type":"string","description":"Валюта оплаты комиссии сервиса"},"netFeeCurrencyCode":{"type":"string","description":"Валюта возмещения комиссии сети"},"requisitesInUrl":{"type":"string","description":"Ссылка для оплаты от внешнего платежного провайдера"},"orderCurrencyType":{"type":"string","description":"Тип валют участвующих в операции","enum":["fiat","crypto","fiatToCrypto","cryptoToFiat"]},"paymentMethod":{"type":"string","description":"Платежный метод","enum":["card","phone","sbp","wallet","transgran","transgran_crypto","wire_transfer","bank_transfer","service"]},"providerCode":{"type":"string","description":"Код фиатного провайдера"},"providerAliasCode":{"type":"string","description":"Человекочитаемый код фиатного провайдера"},"paymentSettingsName":{"type":"string","description":"Название фиатной настройки"},"providerName":{"type":"string","description":"Название фиатного провайдера"},"amlReportExists":{"type":"boolean","description":"Существует AML отчет по ордеру?"},"minFeeTriggerAmount":{"type":"string","description":"Порог, на котором изменяется принцип рассчета комиссии"},"paymentTiming":{"type":"string","description":"Оплата во время или после просрочки","enum":["onTime","afterDue"]},"amountValidity":{"type":"string","description":"Валидность суммы платежа","enum":["less","valid","greater"]},"signature":{"type":"string","description":"Подпись запроса в хуке (для проверки подлинности)"},"warningCode":{"type":"string","description":"Код предупреждения"},"giftCode":{"type":"string","description":"Код активации услуги"}},"required":["id","uid","createdAt","updatedAt","deletedAt","serviceCommission","netCommission","comment","publicComment","merchantUid","merchantName","merchantId","type","status","invoiceCurrencyCode","currencyInCode","currencyOutCode","invoiceAmount","amountInExpected","amountInFact","amountOutExpected","amountOutFact","hedgeRate","isDone","apiMode","risk","requisites","requisitesIn","requisitesOut","requisitesMemoTag","requisitesMemoTagIn","requisitesMemoTagOut","billingTag","requisitesQrCode","assetInCode","assetOutCode","networkInCode","networkOutCode","balanceAfter","balanceAccountAfter","callbackUrl","invoicePublicUrl","txId","refundTxId","expirationTime","isImPayed","isBayerPaysService","serviceFeeCurrencyCode","netFeeCurrencyCode","requisitesInUrl","orderCurrencyType","amlReportExists","paymentTiming","amountValidity","signature","warningCode","giftCode"]},"CustomBadRequestException":{"type":"object","properties":{"error":{"type":"string","description":"Описание ошибки"},"errorCode":{"type":"number","description":"Код ошибки"}},"required":["errorCode"]},"CustomUnauthorizedException":{"type":"object","properties":{"error":{"type":"string","description":"Описание ошибки"},"errorCode":{"type":"number","description":"Код ошибки"}},"required":["errorCode"]},"CustomForbiddenException":{"type":"object","properties":{"error":{"type":"string","description":"Описание ошибки"},"errorCode":{"type":"number","description":"Код ошибки"}},"required":["errorCode"]},"CustomInternalErrorException":{"type":"object","properties":{"error":{"type":"string","description":"Описание ошибки"},"errorCode":{"type":"number","description":"Код ошибки"}},"required":["errorCode"]}}}}
```

## Конвертация и перевод средств между различными сетями Coin/Coin

{% openapi src="<https://pay.alfabit.org/api/integration-json?any=5>" path="/api/v1/integration/orders/currency-to-currency" method="post" %}
<https://pay.alfabit.org/api/integration-json?any=5>
{% endopenapi %}


---

# 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://alfabit.gitbook.io/alfabit-pay/rukovodstvo-po-integracii/konvertaciya-i-perevod-sredstv-mezhdu-razlichnymi-setyami-most.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.
