> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tranzor.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Заказать eSIM

> Создаёт заказ eSIM и платёжный инвойс. **eSIM активируется автоматически после оплаты.**

Флоу:
1. Вызовите POST — получите `payUrl` и адреса для оплаты
2. Клиент оплачивает инвойс криптовалютой
3. Система автоматически обнаруживает платёж и активирует eSIM
4. Проверяйте статус через GET /api/v1/esim/{orderId}
5. Когда `status` = `active` — QR-код и ICCID доступны в ответе



## OpenAPI

````yaml POST /api/v1/esim/order
openapi: 3.1.0
info:
  title: Tranzor API
  description: >-
    API для приёма криптовалютных платежей и ресселинга eSIM. Создавайте
    инвойсы, продавайте eSIM, отслеживайте статусы.
  version: 1.0.0
  contact:
    name: Tranzor Support
    url: https://tranzor.io
servers:
  - url: https://sand.tranzor.io
    description: Sandbox
security:
  - BearerAuth: []
  - HmacAuth: []
externalDocs:
  description: Полная документация
  url: https://docs.tranzor.io/
paths:
  /api/v1/esim/order:
    post:
      tags:
        - eSIM
      summary: Заказать eSIM
      description: >-
        Создаёт заказ eSIM и платёжный инвойс. **eSIM активируется автоматически
        после оплаты.**


        Флоу:

        1. Вызовите POST — получите `payUrl` и адреса для оплаты

        2. Клиент оплачивает инвойс криптовалютой

        3. Система автоматически обнаруживает платёж и активирует eSIM

        4. Проверяйте статус через GET /api/v1/esim/{orderId}

        5. Когда `status` = `active` — QR-код и ICCID доступны в ответе
      operationId: orderEsim
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - planId
              properties:
                planId:
                  type: string
                  description: ID тарифа из GET /api/v1/esim
                clientEmail:
                  type: string
                  format: email
                  description: Email клиента для уведомлений (опционально)
                clientRef:
                  type: string
                  description: >-
                    Ваш внутренний ID заказа (опционально, используется как
                    orderId инвойса)
      responses:
        '200':
          description: Заказ создан, ожидает оплаты
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      orderId:
                        type: string
                        description: ID заказа eSIM для отслеживания
                      status:
                        type: string
                        example: pending
                        description: pending → provisioning → active
                      invoiceId:
                        type: string
                        description: ID платёжного инвойса
                      payUrl:
                        type: string
                        format: uri
                        description: Ссылка на страницу оплаты для клиента
                      amount:
                        type: number
                        example: 12.5
                      currency:
                        type: string
                        example: USD
                      plan:
                        type: object
                        properties:
                          country:
                            type: string
                          countryIso:
                            type: string
                          dataGb:
                            type: string
                          days:
                            type: integer
                      addresses:
                        type: array
                        description: Адреса для оплаты криптовалютой
                        items:
                          type: object
                          properties:
                            chain:
                              type: string
                              example: tron
                            address:
                              type: string
                            expectedAmount:
                              type: string
                            isToken:
                              type: boolean
                            tokenSymbol:
                              type: string
                              nullable: true
                      expiresAt:
                        type: string
                        format: date-time
                        description: Срок оплаты
                      note:
                        type: string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  responses:
    Unauthorized:
      description: Не авторизован
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: Invalid API key
    NotFound:
      description: Не найдено
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                example: false
              error:
                type: string
                example: Invoice not found
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API ключ в формате `trz_...`
    HmacAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: |-
        HMAC аутентификация. Требуются заголовки:
        - `X-API-Key` — ваш API ключ
        - `X-Timestamp` — текущий unix timestamp (секунды, ±5 мин)
        - `X-Signature` — HMAC-SHA256 подпись

        Строка для подписи: `{timestamp}{METHOD}{path}{body}`
        Ключ подписи: `Secret Key` (выдаётся при создании API ключа)

````