{
  "openapi": "3.0.0",
  "info": {
    "title": "PSPAY P2P API Documentation",
    "description": "API для работы с платежами (Payin), выплатами (Payouts), ECOM, SberPay QR, субмерчантами и апелляциями на платформе PSPAY P2P. Полная текстовая документация — https://doc.pspay.io/",
    "version": "1.0.7"
  },
  "servers": [
    {
      "url": "https://api.pspay.io"
    }
  ],
  "paths": {
    "/api/v1/submerchant/create": {
      "post": {
        "summary": "Регистрация субмерчанта",
        "description": "Создаёт субмерчанта. external_id затем передаётся как submerchant_id в order/create. Пара merchant + external_id уникальна.",
        "tags": [
          "Submerchants"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "external_id"
                ],
                "properties": {
                  "external_id": {
                    "type": "string",
                    "description": "Постоянный Merchant ID конечного мерча. Это же значение передаётся в submerchant_id.",
                    "example": "shop_alpha"
                  },
                  "title": {
                    "type": "string",
                    "description": "Название конечного мерча. Алиас: name.",
                    "example": "Shop Alpha"
                  },
                  "name": {
                    "type": "string",
                    "description": "Алиас для title. Если title пустой — берётся name.",
                    "example": "Shop Alpha"
                  },
                  "url": {
                    "type": "string",
                    "example": "https://shop-alpha.example"
                  },
                  "traffic_type": {
                    "type": "string",
                    "enum": [
                      "FD",
                      "TRUSTED",
                      "MIXED"
                    ],
                    "example": "MIXED"
                  },
                  "commission": {
                    "type": "number",
                    "example": 0
                  },
                  "min_tx_amount": {
                    "type": "number"
                  },
                  "max_tx_amount": {
                    "type": "number"
                  },
                  "daily_limit": {
                    "type": "number"
                  },
                  "is_active": {
                    "type": "integer",
                    "description": "Если не передан — 0",
                    "example": 1
                  },
                  "traders_group": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Субмерчант создан",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "id": {
                      "type": "integer",
                      "example": 1842
                    },
                    "title": {
                      "type": "string",
                      "example": "Shop Alpha"
                    },
                    "commission": {
                      "type": "number",
                      "example": 0
                    },
                    "url": {
                      "type": "string",
                      "example": "https://shop-alpha.example"
                    },
                    "external_id": {
                      "type": "string",
                      "example": "shop_alpha"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "103: external_id is required / Submerchant with this external_id already exists. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/submerchant/update": {
      "post": {
        "summary": "Обновление субмерчанта",
        "description": "Обновляет title и/или url. Ищется по паре merchant + external_id. name — алиас title.",
        "tags": [
          "Submerchants"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "external_id"
                ],
                "properties": {
                  "external_id": {
                    "type": "string",
                    "description": "Merchant ID конечного мерча — тот же, что при регистрации.",
                    "example": "shop_alpha"
                  },
                  "title": {
                    "type": "string",
                    "description": "Новое название. Алиас: name.",
                    "example": "Shop Alpha"
                  },
                  "name": {
                    "type": "string",
                    "description": "Алиас для title.",
                    "example": "Shop Alpha"
                  },
                  "url": {
                    "type": "string",
                    "example": "https://shop-alpha.example"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Субмерчант обновлён",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "id": {
                      "type": "integer",
                      "example": 1842
                    },
                    "title": {
                      "type": "string",
                      "example": "Shop Alpha"
                    },
                    "url": {
                      "type": "string",
                      "example": "https://shop-alpha.example"
                    },
                    "external_id": {
                      "type": "string",
                      "example": "shop_alpha"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "103: external_id is required / title or url is required / Submerchant not found. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/submerchant/list": {
      "get": {
        "summary": "Список субмерчантов",
        "description": "Возвращает всех субмерчантов, зарегистрированных на API-токен.",
        "tags": [
          "Submerchants"
        ],
        "responses": {
          "200": {
            "description": "Список субмерчантов",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "submerchants": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "1842"
                          },
                          "title": {
                            "type": "string",
                            "example": "Shop Alpha"
                          },
                          "external_id": {
                            "type": "string",
                            "example": "shop_alpha"
                          },
                          "url": {
                            "type": "string"
                          },
                          "traffic_type": {
                            "type": "string",
                            "example": "MIXED"
                          },
                          "is_active": {
                            "type": "string",
                            "example": "1"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/order/create": {
      "post": {
        "summary": "Создание ордера",
        "tags": [
          "Payin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор ордера",
                    "example": "ORD12345"
                  },
                  "customer_id": {
                    "type": "string",
                    "description": "Постоянный идентификатор плательщика. Один плательщик — одно значение во всех платежах.",
                    "example": "781"
                  },
                  "submerchant_id": {
                    "type": "string",
                    "description": "Постоянный Merchant ID конечного мерча. Должен совпадать с external_id зарегистрированного субмерчанта.",
                    "example": "shop_alpha"
                  },
                  "customer_name": {
                    "type": "string",
                    "description": "Для части гео (в т.ч. Турция) обязательно"
                  },
                  "amount": {
                    "type": "number",
                    "format": "decimal",
                    "description": "Сумма ордера",
                    "example": 1500.0
                  },
                  "cred_type": {
                    "type": "integer",
                    "description": "Тип получателя: 1 — номер карты, 2 — СБП",
                    "example": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешное создание ордера",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "amount": {
                      "type": "number",
                      "example": 500
                    },
                    "usdt_amount": {
                      "type": "number",
                      "format": "decimal",
                      "example": 11.67
                    },
                    "usdt_rate": {
                      "type": "number",
                      "format": "decimal",
                      "example": 42.85
                    },
                    "order_id": {
                      "type": "string",
                      "example": "323432143"
                    },
                    "transaction_id": {
                      "type": "integer",
                      "example": 167259
                    },
                    "bank_name": {
                      "type": "string",
                      "example": "Монобанк UA"
                    },
                    "receiver_name": {
                      "type": "string",
                      "example": "Артем М."
                    },
                    "cred": {
                      "type": "string",
                      "example": "4441111065570016"
                    },
                    "cred_formatted": {
                      "type": "string",
                      "example": "4441 1110 6557 0016"
                    },
                    "cred_type": {
                      "type": "integer",
                      "example": 1
                    },
                    "redirect_url": {
                      "type": "string",
                      "example": "https://checkout.pspay.io/?id=167516&hash=9f5ab8822edc1129fb33125666cb0603c1c14ecf5f75209442c1de6b2020c997"
                    },
                    "deadline": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2025-08-25T20:18:43Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "102: Сумма ниже минимальной в обработчике подбора. В общем потоке v1/v2/v4 предварительная проверка возвращает 106.; 103: Превышена максимальная сумма; customer_id is required; Customer is not allowed; Customer is blocked; submerchant_id is required / is not registered.; 105: Invalid cred_type — неверный тип реквизитов.; 106: Нет подходящих реквизитов/провайдера, сумма ниже минимума, субмерчант временно отключён (Merchant is temporary disabled), ошибка создания/проверки ордера. Возможен текст отказа провайдера.; 1011: Merchant's USDT rate not found — курс мерчанта не настроен. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Order ID already exists / Order ID is already being processed — дубликат или параллельное создание. Перед повтором проверьте статус.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Отказ при подборе/резервировании: клиент не подходит, реквизит или трейдер занят/отключён, изменились лимиты, маршрут, интервал или доступный депозит. Итоговый отказ после повторного подбора/каскада может быть 106.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Invalid lifetime — некорректное время жизни ордера. Текущий HTTP-статус для этого кода — 404.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/order/status": {
      "post": {
        "summary": "Проверка статуса ордера",
        "tags": [
          "Payin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор ордера",
                    "example": "ORD12345"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Статус ордера",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "order_data": {
                      "type": "object",
                      "properties": {
                        "order_id": {
                          "type": "string",
                          "example": "1756152755766_32lxfyu"
                        },
                        "transaction_id": {
                          "type": "integer",
                          "example": 167259
                        },
                        "amount": {
                          "type": "string",
                          "example": "666.00"
                        },
                        "usdt_amount": {
                          "type": "string",
                          "description": "Сумма в USDT",
                          "example": "15.52"
                        },
                        "usdt_rate": {
                          "type": "string",
                          "description": "Курс USDT к гривне",
                          "example": "42.91"
                        },
                        "amount_initial": {
                          "type": "string",
                          "nullable": true,
                          "description": "Изначальная сумма ордера",
                          "example": "666.00"
                        },
                        "commission": {
                          "type": "string",
                          "description": "Комиссия мерчанта",
                          "example": "34.97"
                        },
                        "merch_amount": {
                          "type": "string",
                          "description": "Сумма к зачислению мерчанту",
                          "example": "631.04"
                        },
                        "cred": {
                          "type": "string",
                          "example": "4441111065570016"
                        },
                        "cred_formatted": {
                          "type": "string",
                          "example": "4441 1110 6557 0016"
                        },
                        "cred_type": {
                          "type": "string",
                          "example": "1"
                        },
                        "receiver_name": {
                          "type": "string",
                          "example": "Артем М."
                        },
                        "receiver_bank": {
                          "type": "string",
                          "example": "Монобанк UA"
                        },
                        "status_id": {
                          "type": "integer",
                          "description": "Статус ордера: 1 - Новая, 2 - Реквизиты выданы, 3 - Клиент оплатил, 4 - Клиент отменил, 5 - Исполнено, 6 - Отказ, 7 - Аппеляция, 8 - Не взят в работу, 9 - Просрочено",
                          "enum": [
                            1,
                            2,
                            3,
                            4,
                            5,
                            6,
                            7,
                            8,
                            9
                          ],
                          "example": 5
                        },
                        "deadline": {
                          "type": "string",
                          "format": "date-time",
                          "example": "2025-08-26T13:16:20Z"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "106: Order not found — ордер мерчанта не найден (HTTP 400).; 107: Order ID or Transaction ID is required. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/payout/create": {
      "post": {
        "summary": "Создание выплаты (v2)",
        "description": "Расширенная версия создания выплат с поддержкой валют. Типы получателя: карта, СБП, банковский счёт и QR НСПК (cred_type = 4, ссылка https://qr.nspk.ru/<id>; только для мерчантов, подключённых к выплатам по QR, иначе 108). Для QR сумма берётся из НСПК: amount необязателен, если в QR есть сумма (переданное значение должно совпасть — 122), и обязателен, если суммы в QR нет (123).",
        "tags": [
          "Payouts v2"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "cred",
                  "cred_type",
                  "amount"
                ],
                "properties": {
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор выплаты",
                    "example": "payout-test-1"
                  },
                  "cred": {
                    "type": "string",
                    "description": "Данные получателя: номер карты, телефон СБП, номер счёта (cred_type = 3) или ссылка НСПК https://qr.nspk.ru/<32 символа> (cred_type = 4, до 1024 байт)",
                    "example": "5168752060221193"
                  },
                  "cred_type": {
                    "type": "integer",
                    "description": "Тип получателя: 1 — номер карты, 2 — СБП, 3 — номер счёта, 4 — QR НСПК (только для мерчантов с выплатами по QR)",
                    "example": 1
                  },
                  "amount": {
                    "type": "number",
                    "format": "decimal",
                    "description": "Сумма выплаты от 0.01 до 99999999.99, не более двух знаков после точки",
                    "minimum": 0.01,
                    "maximum": 99999999.99,
                    "multipleOf": 0.01,
                    "example": 2000.0
                  },
                  "currency": {
                    "type": "string",
                    "description": "Код валюты (опциональный, по умолчанию UAH)",
                    "example": "UAH",
                    "default": "UAH"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешное создание выплаты",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "amount": {
                      "type": "number",
                      "format": "decimal",
                      "example": 4000.0
                    },
                    "commission": {
                      "type": "number",
                      "format": "decimal",
                      "example": 86.0
                    },
                    "final_amount": {
                      "type": "number",
                      "format": "decimal",
                      "example": 4086.0
                    },
                    "payout_id": {
                      "type": "integer",
                      "example": 2720
                    },
                    "cred_formatted": {
                      "type": "string",
                      "description": "Отформатированные реквизиты (карта по 4 цифры, телефон в международном формате)",
                      "example": "4441 1110 6557 0016"
                    },
                    "currency": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 5
                        },
                        "code": {
                          "type": "string",
                          "example": "UAH"
                        },
                        "title": {
                          "type": "string",
                          "example": "UAH"
                        }
                      }
                    },
                    "receiver_country": {
                      "type": "string",
                      "description": "ISO код страны получателя",
                      "example": "UA"
                    },
                    "receiver_bank": {
                      "type": "string",
                      "description": "Название банка-эмитента (только для карт)",
                      "example": "ПриватБанк"
                    },
                    "bank_info": {
                      "type": "object",
                      "description": "Дополнительная информация о банке (только для карт)",
                      "properties": {
                        "name": {
                          "type": "string",
                          "example": "ПриватБанк"
                        },
                        "country": {
                          "type": "string",
                          "example": "UKR"
                        },
                        "payment_system": {
                          "type": "string",
                          "example": "MASTERCARD"
                        }
                      }
                    },
                    "country_info": {
                      "type": "object",
                      "description": "Информация о стране (только для телефонов)",
                      "properties": {
                        "country": {
                          "type": "string",
                          "example": "Ukraine"
                        },
                        "code": {
                          "type": "string",
                          "example": "+380"
                        },
                        "name": {
                          "type": "string",
                          "example": "Україна"
                        },
                        "iso": {
                          "type": "string",
                          "example": "UA"
                        }
                      }
                    },
                    "country_iso": {
                      "type": "string",
                      "description": "ISO код страны (только для телефонов)",
                      "example": "UA"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.; 114: Payouts are disabled for this merchant — выплаты отключены.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Order ID already exists — идентификатор выплаты уже занят.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "106: Invalid card number — неверный номер карты.; 107: Invalid phone number format.; 108: Invalid cred_type (в том числе cred_type = 4 для мерчанта без выплат по QR).; 115: Order ID is required; must contain 1 to 255 bytes after trimming; NOW() and NULL are reserved.; 116: recipient_name is required for cred_type 3 (account payout).; 117: Account number is required.; 118: QR payload is required.; 119: QR payload must not exceed 1024 bytes.; 120: QR payload must be an NSPK payment link https://qr.nspk.ru/<id>.; 121: НСПК отклонила ссылку или недоступна (в тексте код и сообщение НСПК).; 122: amount does not match NSPK payment link amount.; 123: amount is required: NSPK payment link has no fixed amount.; 400: amount must be between 0.01 and 99999999.99 with at most 2 decimal places. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Insufficient balance — недостаточно средств с учётом комиссии.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "112: Default currency (RUB) not found in database — ошибка настройки валюты. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v2/payout/status": {
      "post": {
        "summary": "Получение статуса выплаты (v2)",
        "description": "Расширенная версия получения статуса выплаты с дополнительной информацией о банке и валюте",
        "tags": [
          "Payouts v2"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "payout_id": {
                    "type": "integer",
                    "description": "Уникальный идентификатор выплаты (необязательный)"
                  },
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор ордера клиента (необязательный)"
                  }
                },
                "example": {
                  "order_id": "payout-test-1"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ с расширенными деталями выплаты",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "payout_id": {
                      "type": "integer",
                      "example": 2720
                    },
                    "order_id": {
                      "type": "string",
                      "example": "demo-payout-001"
                    },
                    "type": {
                      "type": "string",
                      "example": "CARD",
                      "enum": [
                        "CARD",
                        "SBP"
                      ]
                    },
                    "amount": {
                      "type": "string",
                      "example": "4000.00"
                    },
                    "commission": {
                      "type": "string",
                      "example": "86.00"
                    },
                    "payout_status": {
                      "type": "string",
                      "example": "COMPLETED",
                      "enum": [
                        "NEW",
                        "PROCESSING",
                        "COMPLETED",
                        "FAILED",
                        "CANCELLED"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "description": "Дата и время создания выплаты в формате YYYY-MM-DD HH:MM:SS",
                      "example": "2025-08-13 19:31:28"
                    },
                    "updated_at": {
                      "type": "string",
                      "description": "Дата и время последнего обновления выплаты в формате YYYY-MM-DD HH:MM:SS",
                      "example": "2025-08-14 10:14:31"
                    },
                    "cred_formatted": {
                      "type": "string",
                      "description": "Отформатированные реквизиты",
                      "example": "5375 4114 0488 8284"
                    },
                    "currency": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer",
                          "example": 5
                        },
                        "code": {
                          "type": "string",
                          "example": "UAH"
                        },
                        "title": {
                          "type": "string",
                          "example": "UAH"
                        }
                      }
                    },
                    "receiver_country": {
                      "type": "string",
                      "description": "ISO код страны получателя",
                      "example": "UA"
                    },
                    "receiver_bank": {
                      "type": "string",
                      "description": "Название банка-эмитента (только для карт)",
                      "example": "Монобанк"
                    },
                    "bank_info": {
                      "type": "object",
                      "description": "Дополнительная информация о банке (только для карт)",
                      "properties": {
                        "name": {
                          "type": "string",
                          "example": "Монобанк"
                        },
                        "country": {
                          "type": "string",
                          "example": "UKR"
                        },
                        "payment_system": {
                          "type": "string",
                          "example": "MASTERCARD"
                        }
                      }
                    },
                    "country_info": {
                      "type": "object",
                      "description": "Информация о стране (только для телефонов)",
                      "properties": {
                        "country": {
                          "type": "string",
                          "example": "Ukraine"
                        },
                        "code": {
                          "type": "string",
                          "example": "+380"
                        },
                        "name": {
                          "type": "string",
                          "example": "Україна"
                        },
                        "iso": {
                          "type": "string",
                          "example": "UA"
                        }
                      }
                    },
                    "country_iso": {
                      "type": "string",
                      "description": "ISO код страны (только для телефонов)",
                      "example": "UA"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Payout not found — выплата мерчанта не найдена.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "111: Either payout_id or order_id must be provided. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/payout/details": {
      "post": {
        "summary": "Получение детальной информации по выплате",
        "description": "Возвращает расширенную информацию о выплате включая чеки и детали транзакций",
        "tags": [
          "Payouts v2"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "anyOf": [
                  {
                    "required": [
                      "payout_id"
                    ]
                  },
                  {
                    "required": [
                      "order_id"
                    ]
                  }
                ],
                "properties": {
                  "payout_id": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Внутренний ID выплаты; имеет приоритет над order_id, если переданы оба идентификатора.",
                    "example": 2720
                  },
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор ордера клиента",
                    "example": "TEST-USER-14"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ с детальной информацией о выплате",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "payout_data": {
                      "type": "object",
                      "properties": {
                        "payout_id": {
                          "type": "string",
                          "example": "2720"
                        },
                        "order_id": {
                          "type": "string",
                          "example": "demo-payout-001"
                        },
                        "type": {
                          "type": "string",
                          "example": "SBP",
                          "enum": [
                            "CARD",
                            "SBP",
                            "ACCOUNT",
                            "QR"
                          ]
                        },
                        "cred_type": {
                          "type": "integer",
                          "description": "Тип получателя: 1 — номер карты, 2 — телефон СБП, 3 — банковский счёт, 4 — QR НСПК.",
                          "example": 1
                        },
                        "amount": {
                          "type": "string",
                          "example": "4000.00"
                        },
                        "filled_amount": {
                          "type": "string",
                          "example": "4000.00"
                        },
                        "commission": {
                          "type": "string",
                          "example": "86.00"
                        },
                        "trader_commission": {
                          "type": "string",
                          "example": "52.00"
                        },
                        "payout_status": {
                          "type": "string",
                          "example": "COMPLETED"
                        },
                        "created_at": {
                          "type": "string",
                          "description": "Дата и время создания выплаты",
                          "example": "2025-08-17 14:25:36"
                        },
                        "updated_at": {
                          "type": "string",
                          "description": "Дата и время последнего обновления выплаты",
                          "example": "2025-08-17 17:26:45"
                        },
                        "cred_formatted": {
                          "type": "string",
                          "description": "Отформатированные реквизиты",
                          "example": "4441 1110 6557 0016"
                        },
                        "recipient_name": {
                          "type": "string",
                          "description": "Имя получателя",
                          "example": "Оксана Коваленко"
                        },
                        "sender_names_from_checks": {
                          "type": "array",
                          "description": "Имена отправителей из чеков",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "Марія Шевченко"
                          ]
                        },
                        "recipient_names_from_checks": {
                          "type": "array",
                          "description": "Имена получателей из чеков",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "Оксана К."
                          ]
                        },
                        "currency": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer",
                              "example": 5
                            },
                            "code": {
                              "type": "string",
                              "example": "UAH"
                            },
                            "title": {
                              "type": "string",
                              "example": "UAH"
                            }
                          }
                        },
                        "receiver_country": {
                          "type": "string",
                          "description": "ISO код страны получателя",
                          "example": "UA"
                        },
                        "country_info": {
                          "type": "object",
                          "description": "Информация о стране",
                          "properties": {
                            "country": {
                              "type": "string",
                              "example": "Ukraine"
                            },
                            "code": {
                              "type": "string",
                              "example": "+380"
                            },
                            "name": {
                              "type": "string",
                              "example": "Україна"
                            },
                            "iso": {
                              "type": "string",
                              "example": "UA"
                            }
                          }
                        },
                        "country_iso": {
                          "type": "string",
                          "description": "ISO код страны",
                          "example": "UA"
                        },
                        "receiver_bank": {
                          "type": "string",
                          "description": "Название банка получателя",
                          "example": "Ощадбанк"
                        }
                      }
                    },
                    "checks": {
                      "type": "array",
                      "description": "Массив чеков для данной выплаты",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer",
                            "example": 19
                          },
                          "check_url": {
                            "type": "string",
                            "description": "URL для скачивания чека",
                            "example": "https://minio.pspay.io/my-bucket/check_1750170400.pdf"
                          },
                          "date": {
                            "type": "string",
                            "description": "Дата операции",
                            "example": "2025-08-17 16:52:19"
                          },
                          "amount": {
                            "type": "string",
                            "example": "24000.00"
                          },
                          "created_at": {
                            "type": "string",
                            "description": "Дата создания записи чека",
                            "example": "2025-08-17 17:26:45"
                          },
                          "receiving_bank": {
                            "type": "string",
                            "example": "Монобанк"
                          },
                          "sender": {
                            "type": "string",
                            "example": "Марія Шевченко"
                          },
                          "recipient": {
                            "type": "string",
                            "example": "Оксана К."
                          },
                          "bank": {
                            "type": "string",
                            "example": "Монобанк"
                          },
                          "parsed_details": {
                            "type": "object",
                            "description": "Детали транзакции, извлеченные из чека",
                            "properties": {
                              "transaction_date": {
                                "type": "string",
                                "example": "2025-08-17 16:52:19"
                              },
                              "total_amount": {
                                "type": "string",
                                "example": "24000.00"
                              },
                              "recipient_cred": {
                                "type": "string",
                                "example": ""
                              },
                              "receiving_bank": {
                                "type": "string",
                                "example": "Монобанк"
                              },
                              "sender": {
                                "type": "string",
                                "example": "Марія Шевченко"
                              },
                              "recipient": {
                                "type": "string",
                                "example": "Оксана К."
                              },
                              "receipt_type": {
                                "type": "string",
                                "example": "SBP Монобанк"
                              },
                              "amount": {
                                "type": "number",
                                "example": 24000
                              },
                              "commission": {
                                "type": "number",
                                "example": 0
                              },
                              "sbp_id": {
                                "type": "string",
                                "description": "Идентификатор СБП транзакции",
                                "example": "A51681352194090M00000800115"
                              },
                              "recipient_name": {
                                "type": "string",
                                "example": "Оксана К."
                              },
                              "recipient_phone": {
                                "type": "string",
                                "example": "5168752060221193"
                              },
                              "recipient_bank": {
                                "type": "string",
                                "example": "Ощадбанк"
                              },
                              "sender_name": {
                                "type": "string",
                                "example": "Марія Шевченко"
                              },
                              "sender_account": {
                                "type": "string",
                                "description": "Маскированный номер счета отправителя",
                                "example": "408178105000****2953"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true,
                                "example": null
                              },
                              "message": {
                                "type": "string",
                                "nullable": true,
                                "example": null
                              },
                              "operation_type": {
                                "type": "string",
                                "example": "Перевод По номеру телефона"
                              },
                              "receipt_number": {
                                "type": "string",
                                "example": "1-24-920-977-205"
                              },
                              "receipt_created": {
                                "type": "string",
                                "example": "2025-08-17 16:52:19"
                              }
                            }
                          }
                        }
                      }
                    },
                    "checks_count": {
                      "type": "integer",
                      "description": "Количество чеков",
                      "example": 1
                    },
                    "total_checks_amount": {
                      "type": "number",
                      "description": "Общая сумма по всем чекам",
                      "example": 24000
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Payout not found — выплата мерчанта не найдена.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "111: Either payout_id or order_id must be provided. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/appeal/create": {
      "post": {
        "summary": "Создание апелляции",
        "tags": [
          "Appeals"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string",
                    "description": "Уникальный идентификатор ордера",
                    "example": "ORD12345"
                  },
                  "comments": {
                    "type": "string",
                    "description": "Комментарий к апелляции",
                    "example": "Проблема с оплатой, прошу разобраться."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Апелляция успешно создана",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "appeal_id": {
                      "type": "integer",
                      "example": 6789
                    },
                    "upload_url": {
                      "type": "string",
                      "example": "https://api.pspay.io/appeal/upload?hash=abcd1234efgh5678"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "102: Необходимо передать Order ID.; 105: Диспут по этому заказу уже существует, создать новый нельзя.; 107: Не передан чек при обязательной загрузке receipt.; 108: Invalid base64 receipt либо недопустимое содержимое файла.; 111: Срок открытия диспута истёк; срок указан в сообщении. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Заказ для данного мерчанта не найден (HTTP 409).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Receipt too large (max 5 MB) — превышен лимит декодированного base64-чека.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Ордер уже исполнен — открытие диспута недоступно (HTTP 404).; 404: Апелляция не найдена для загрузки чека.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500: Не удалось сохранить или загрузить чек. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/appeal/upload": {
      "post": {
        "summary": "Загрузка скриншота для апелляции",
        "tags": [
          "Appeals"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "hash",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Хеш апелляции"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешная загрузка файла",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "file_url": {
                      "type": "string",
                      "example": "https://minio.pspay.io/my-bucket/appeal_screenshot_abcd1234efgh5678.png"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400: Hash is required / File is required / Invalid file. При Invalid file поле message: Cannot read uploaded file; File too small (меньше 100 байт); Invalid file content (not a receipt image, PDF or video); Unsupported file type (allowed: PDF, JPEG, PNG, WEBP, MP4, WebM, MOV); Video too large (max 64 MB); Cannot extract PDF from signed receipt; Cannot normalize uploaded file.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404: Appeal not found.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "500: Invalid file; подробности ошибки загрузки в message.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/appeal/status": {
      "post": {
        "summary": "Получение статуса апелляции",
        "tags": [
          "Appeals"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "appeal_id": {
                    "type": "integer",
                    "description": "Уникальный идентификатор апелляции",
                    "example": 123
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Статус апелляции",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "appeal_data": {
                      "type": "object",
                      "properties": {
                        "appeal_id": {
                          "type": "integer",
                          "example": 123
                        },
                        "order_id": {
                          "type": "string",
                          "example": "ORD12345"
                        },
                        "appeal_status": {
                          "type": "string",
                          "example": "Pending"
                        },
                        "comments": {
                          "type": "string",
                          "example": "Проблема с оплатой"
                        },
                        "screenshot": {
                          "type": "string",
                          "example": "https://minio.pspay.io/my-bucket/appeal_screenshot_abcd1234efgh5678.png"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400: Необходимо передать Appeal ID. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404: Апелляция не найдена.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/appeal/list": {
      "post": {
        "summary": "Получение списка апелляций",
        "description": "Возвращает список всех апелляций с возможностью фильтрации по статусу",
        "tags": [
          "Appeals"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "integer",
                    "description": "Статус апелляции для фильтрации: 1 - Новый, 2 - Отклонена (фейковый чек), 3 - Отклонена (нет оплаты), 4 - Отклонена (неверная сумма), 5 - Удовлетворена (исполнить ордер), 6 - Удовлетворена (изменить сумму и исполнить), 7 - Отправить на модерацию изменения суммы",
                    "example": 5,
                    "enum": [
                      1,
                      2,
                      3,
                      4,
                      5,
                      6,
                      7
                    ]
                  }
                },
                "example": {
                  "status": 5
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Список апелляций",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "appeals": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "appeal_id": {
                            "type": "integer",
                            "example": 1311
                          },
                          "appeal_datetime": {
                            "type": "string",
                            "nullable": true,
                            "format": "date-time",
                            "description": "Дата и время создания апелляции",
                            "example": null
                          },
                          "amount": {
                            "type": "string",
                            "example": "5058.00"
                          },
                          "transaction": {
                            "type": "object",
                            "properties": {
                              "datetime": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-08-19 18:09:02"
                              },
                              "id": {
                                "type": "integer",
                                "example": 36
                              },
                              "merchant_order_id": {
                                "type": "string",
                                "example": "тaa1a1aaaaa"
                              }
                            }
                          },
                          "status": {
                            "type": "integer",
                            "description": "Статус апелляции: 1 - Новый, 2 - Отклонена (фейковый чек), 3 - Отклонена (нет оплаты), 4 - Отклонена (неверная сумма), 5 - Удовлетворена (исполнить ордер), 6 - Удовлетворена (изменить сумму и исполнить), 7 - Отправить на модерацию изменения суммы",
                            "example": 5,
                            "enum": [
                              1,
                              2,
                              3,
                              4,
                              5,
                              6,
                              7
                            ]
                          },
                          "comment": {
                            "type": "string",
                            "nullable": true,
                            "example": null
                          },
                          "screenshot": {
                            "type": "string",
                            "example": ""
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/orders/list": {
      "post": {
        "summary": "Получение списка ордеров",
        "description": "Возвращает список ордеров мерчанта с фильтрацией по статусу, дате создания, дате исполнения и опциональной пагинацией. Без page/page_size обязателен диапазон дат не длиннее 31 дня (включительно): date_from + date_to или executed_date_from + executed_date_to, и в одном ответе не более 10000 ордеров. page_size — от 1 до 1000. При нарушении — ошибка с кодом 400.",
        "tags": [
          "Payin"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status_id": {
                    "type": "integer",
                    "description": "Фильтр по статусу ордера (опционально)",
                    "example": 2
                  },
                  "date_from": {
                    "type": "string",
                    "format": "date",
                    "description": "Начало диапазона по дате создания, YYYY-MM-DD",
                    "example": "2025-10-01"
                  },
                  "date_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Конец диапазона по дате создания, YYYY-MM-DD",
                    "example": "2025-10-31"
                  },
                  "created_date_from": {
                    "type": "string",
                    "format": "date",
                    "description": "Синоним date_from (используется, если date_from не передан)"
                  },
                  "created_date_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Синоним date_to (используется, если date_to не передан)"
                  },
                  "executed_date_from": {
                    "type": "string",
                    "format": "date",
                    "description": "Начало диапазона по дате исполнения, YYYY-MM-DD"
                  },
                  "executed_date_to": {
                    "type": "string",
                    "format": "date",
                    "description": "Конец диапазона по дате исполнения, YYYY-MM-DD"
                  },
                  "page": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Номер страницы (с 1)"
                  },
                  "page_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000,
                    "description": "Размер страницы (по умолчанию 100, если пагинация включена)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Список ордеров",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "string",
                            "example": "1756152755766_32lxfyu"
                          },
                          "transaction_id": {
                            "type": "integer",
                            "example": 167259
                          },
                          "amount": {
                            "type": "number",
                            "example": 666.0
                          },
                          "usdt_amount": {
                            "type": "number",
                            "nullable": true,
                            "description": "Сумма в USDT",
                            "example": 15.52
                          },
                          "usdt_rate": {
                            "type": "number",
                            "nullable": true,
                            "description": "Курс USDT к гривне",
                            "example": 42.91
                          },
                          "amount_initial": {
                            "type": "number",
                            "nullable": true,
                            "description": "Изначальная сумма ордера",
                            "example": null
                          },
                          "commission": {
                            "type": "number",
                            "description": "Комиссия мерчанта",
                            "example": 34.97
                          },
                          "merch_amount": {
                            "type": "number",
                            "description": "Сумма к зачислению мерчанту",
                            "example": 631.04
                          },
                          "cred": {
                            "type": "string",
                            "example": "4441111065570016"
                          },
                          "cred_formatted": {
                            "type": "string",
                            "example": "4441 1110 6557 0016"
                          },
                          "cred_type": {
                            "type": "integer",
                            "example": 1
                          },
                          "receiver_name": {
                            "type": "string",
                            "example": "Артем М."
                          },
                          "receiver_bank": {
                            "type": "string",
                            "example": "Монобанк UA"
                          },
                          "status_id": {
                            "type": "integer",
                            "description": "Статус ордера: 1 - Новая, 2 - Реквизиты выданы, 3 - Клиент оплатил, 4 - Клиент отменил, 5 - Исполнено, 6 - Отказ, 7 - Аппеляция, 8 - Не взят в работу, 9 - Просрочено",
                            "example": 5
                          },
                          "deadline": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true,
                            "example": "2025-08-26T13:16:20Z"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400: Некорректная дата (ожидается YYYY-MM-DD), page < 1 или page_size вне 1–1000. Без пагинации обязателен полный диапазон дат не длиннее 31 дня; максимум 10000 ордеров в ответе. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/payouts/list": {
      "post": {
        "summary": "Получение списка выплат",
        "description": "Возвращает список всех выплат мерчанта с возможностью фильтрации по статусу",
        "tags": [
          "Payouts v2"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "description": "Фильтр по статусу выплаты (опционально)",
                    "example": "COMPLETED",
                    "enum": [
                      "NEW",
                      "PROCESSING",
                      "COMPLETED",
                      "FAILED",
                      "CANCELLED"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Список выплат",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "payouts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "payout_id": {
                            "type": "integer",
                            "example": 2992
                          },
                          "order_id": {
                            "type": "string",
                            "example": "test-payout-ua-001"
                          },
                          "type": {
                            "type": "string",
                            "example": "CARD",
                            "enum": [
                              "CARD",
                              "SBP"
                            ]
                          },
                          "cred_type": {
                            "type": "integer",
                            "description": "Тип получателя: 1 — номер карты, 2 — СБП",
                            "example": 1
                          },
                          "amount": {
                            "type": "number",
                            "example": 1000.0
                          },
                          "filled_amount": {
                            "type": "number",
                            "example": 0.0
                          },
                          "commission": {
                            "type": "number",
                            "example": 21.5
                          },
                          "trader_commission": {
                            "type": "number",
                            "example": 0.0
                          },
                          "payout_status": {
                            "type": "string",
                            "example": "NEW",
                            "enum": [
                              "NEW",
                              "PROCESSING",
                              "COMPLETED",
                              "FAILED",
                              "CANCELLED"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "description": "Дата и время создания выплаты в формате YYYY-MM-DD HH:MM:SS",
                            "example": "2025-09-01 19:55:25"
                          },
                          "updated_at": {
                            "type": "string",
                            "description": "Дата и время последнего обновления выплаты в формате YYYY-MM-DD HH:MM:SS",
                            "example": "2025-09-01 19:55:25"
                          },
                          "cred_formatted": {
                            "type": "string",
                            "description": "Отформатированные реквизиты",
                            "example": "4441 1110 6557 0016"
                          },
                          "recipient_name": {
                            "type": "string",
                            "nullable": true,
                            "example": null
                          },
                          "currency": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "integer",
                                "example": 1
                              },
                              "code": {
                                "type": "string",
                                "example": "UAH"
                              },
                              "title": {
                                "type": "string",
                                "example": "UAH"
                              }
                            }
                          },
                          "receiver_country": {
                            "type": "string",
                            "description": "ISO код страны получателя",
                            "example": "UKR"
                          },
                          "country_info": {
                            "type": "object",
                            "description": "Информация о стране (только для телефонов)",
                            "properties": {
                              "country": {
                                "type": "string",
                                "example": "Ukraine"
                              },
                              "code": {
                                "type": "string",
                                "example": "+380"
                              },
                              "name": {
                                "type": "string",
                                "example": "Україна"
                              },
                              "iso": {
                                "type": "string",
                                "example": "UA"
                              }
                            }
                          },
                          "country_iso": {
                            "type": "string",
                            "description": "ISO код страны (только для телефонов)",
                            "example": "UA"
                          },
                          "receiver_bank": {
                            "type": "string",
                            "description": "Название банка получателя (если доступно)",
                            "example": "Монобанк"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/merchant/stats": {
      "post": {
        "summary": "Получение статистики мерчанта",
        "description": "Возвращает статистику мерчанта включая баланс, обороты, комиссии и конверсию",
        "tags": [
          "Merchant"
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "currency_mode": {
                    "type": "string",
                    "description": "Режим валюты: 'base' (фиатная валюта) или 'usdt' (USDT)",
                    "example": "base",
                    "default": "base",
                    "enum": [
                      "base",
                      "usdt"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Статистика мерчанта",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "currency_mode": {
                      "type": "string",
                      "example": "base",
                      "description": "Текущий режим валюты"
                    },
                    "overalls": {
                      "type": "object",
                      "description": "Статистика по исполненным ордерам",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "example": 100000.0,
                          "description": "Общая сумма исполненных ордеров"
                        },
                        "merchant_commission": {
                          "type": "number",
                          "example": 5000.0,
                          "description": "Общая комиссия мерчанта"
                        },
                        "tx_count": {
                          "type": "integer",
                          "example": 50,
                          "description": "Количество исполненных транзакций"
                        }
                      }
                    },
                    "created": {
                      "type": "object",
                      "description": "Статистика по всем созданным ордерам",
                      "properties": {
                        "amount": {
                          "type": "number",
                          "example": 150000.0,
                          "description": "Общая сумма созданных ордеров"
                        },
                        "merchant_commission": {
                          "type": "number",
                          "example": 7500.0,
                          "description": "Ожидаемая комиссия по всем ордерам"
                        },
                        "tx_count": {
                          "type": "integer",
                          "example": 75,
                          "description": "Количество созданных транзакций"
                        }
                      }
                    },
                    "payouts": {
                      "type": "number",
                      "description": "Общая сумма возмещений",
                      "example": 20000.0
                    },
                    "instant_payouts": {
                      "type": "number",
                      "description": "Общая сумма моментальных выплат",
                      "example": 10000.0
                    },
                    "available": {
                      "type": "number",
                      "description": "Доступно к выводу",
                      "example": 80000.0
                    },
                    "conversion": {
                      "type": "number",
                      "description": "Конверсия в процентах (исполнено/создано)",
                      "example": 66.67
                    },
                    "balance": {
                      "type": "number",
                      "description": "Текущий баланс (available - payouts - instant_payouts)",
                      "example": 50000.0
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "102: Invalid currency_mode. Allowed values: 'base', 'usdt'. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v4/order/create": {
      "post": {
        "summary": "Создание ордера с рандомизацией суммы",
        "description": "Создание ордера с автоматическим подбором суммы при нехватке лимита у карты. Ответ — как у POST /api/v1/order/create.",
        "tags": [
          "Payin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "customer_id",
                  "amount",
                  "cred_type"
                ],
                "properties": {
                  "order_id": {
                    "type": "string",
                    "example": "order12345"
                  },
                  "customer_id": {
                    "type": "string",
                    "description": "Постоянный идентификатор плательщика. Один плательщик — одно значение во всех платежах.",
                    "example": "cust-5501"
                  },
                  "submerchant_id": {
                    "type": "string",
                    "description": "Постоянный Merchant ID конечного мерча. Должен совпадать с external_id зарегистрированного субмерчанта.",
                    "example": "shop_alpha"
                  },
                  "customer_name": {
                    "type": "string",
                    "description": "Для части гео (в т.ч. Турция) обязательно"
                  },
                  "amount": {
                    "type": "number",
                    "example": 1000.0
                  },
                  "cred_type": {
                    "type": "integer",
                    "example": 1
                  },
                  "randomize_enable": {
                    "type": "integer",
                    "example": 1
                  },
                  "randomize_direction": {
                    "type": "string",
                    "enum": [
                      "increase",
                      "decrease"
                    ]
                  },
                  "randomize_stepping": {
                    "type": "number",
                    "example": 5
                  },
                  "randomize_max_steps": {
                    "type": "integer"
                  },
                  "randomize_max_final_amount": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешное создание ордера"
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "102: Сумма ниже минимальной в обработчике подбора. В общем потоке v1/v2/v4 предварительная проверка возвращает 106.; 103: Превышена максимальная сумма; customer_id is required; Customer is not allowed; Customer is blocked; submerchant_id is required / is not registered.; 105: Invalid cred_type — неверный тип реквизитов.; 106: Нет подходящих реквизитов/провайдера, сумма ниже минимума, субмерчант временно отключён (Merchant is temporary disabled), ошибка создания/проверки ордера. Возможен текст отказа провайдера.; 108: Payment type … is not allowed for this merchant — тип оплаты запрещён мерчанту (v4).; 1011: Merchant's USDT rate not found — курс мерчанта не настроен. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Order ID already exists / Order ID is already being processed — дубликат или параллельное создание. Перед повтором проверьте статус.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Отказ при подборе/резервировании: клиент не подходит, реквизит или трейдер занят/отключён, изменились лимиты, маршрут, интервал или доступный депозит. Итоговый отказ после повторного подбора/каскада может быть 106.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Invalid lifetime — некорректное время жизни ордера. Текущий HTTP-статус для этого кода — 404.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/order/change_cred": {
      "post": {
        "summary": "Замена реквизита ордера",
        "description": "Замена реквизита у активного ордера (status_id = 2) без новой транзакции. Ровно один из order_id / transaction_id.",
        "tags": [
          "Payin"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "transaction_id": {
                    "type": "integer"
                  },
                  "payer_bank": {
                    "type": "string",
                    "enum": [
                      "SBER",
                      "VTB"
                    ]
                  },
                  "allowed_payer_banks": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ответ как у POST /api/v1/order/create"
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.; 114: Order cannot change cred in current status / Payment method not available for this merchant — замена запрещена состоянием ордера, апелляцией или настройками метода.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "106: Order not found — ордер мерчанта не найден (HTTP 400).; 107: Order ID or Transaction ID is required. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Нет подходящих альтернативных реквизитов.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Неподдерживаемый fallback (Invalid fallback) или ошибка выбора банка плательщика (payer_bank); HTTP 404.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/ecom/init": {
      "post": {
        "summary": "ECOM — инициализация с редиректом",
        "tags": [
          "ECOM"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "amount"
                ],
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "customer_id": {
                    "type": "string"
                  },
                  "return_url": {
                    "type": "string"
                  },
                  "currency": {
                    "type": "string",
                    "example": "RUB"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "checkout_url и session_token"
          },
          "500": {
            "description": "101: API-токен отсутствует, мерчант не найден/не активен.; 103: Сумма превышает максимум мерчанта.; 104: Order ID already exists / Order ID is already being processed.; 106: Сумма ниже минимума, нет доступного ECOM-терминала или ошибка его настройки.; 112: Default currency not found in database.; 500: Ошибка создания/проверки ордера или платёжного провайдера. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400: order_id is required / amount is required and must be numeric / amount must be greater than 0. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/ecom/create": {
      "post": {
        "summary": "ECOM — создание платежа (прямой режим)",
        "tags": [
          "ECOM"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "amount",
                  "card_pan",
                  "card_expire",
                  "card_cvv"
                ],
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "customer_id": {
                    "type": "string"
                  },
                  "card_pan": {
                    "type": "string"
                  },
                  "card_expire": {
                    "type": "string",
                    "description": "MMYY"
                  },
                  "card_cvv": {
                    "type": "string"
                  },
                  "return_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "success, ecom_status; при 3DS — status pending_3ds и acs_url"
          },
          "401": {
            "description": "101: API-токен отсутствует, мерчант не найден/не активен.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "103: Сумма превышает максимум мерчанта.; 106: Сумма ниже минимума, нет доступного ECOM-терминала или ошибка его настройки.; 400: Не переданы amount / card_pan / card_expire / card_cvv либо срок карты истёк (Card has expired). Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Order ID already exists / Order ID is already being processed.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "112: Default currency not found in database.; 500: Ошибка создания/проверки ордера или платёжного провайдера. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/ecom/process": {
      "post": {
        "summary": "ECOM — обработка ранее созданного платежа",
        "tags": [
          "ECOM"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "card_pan",
                  "card_expire",
                  "card_cvv"
                ],
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "card_pan": {
                    "type": "string"
                  },
                  "card_expire": {
                    "type": "string"
                  },
                  "card_cvv": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Результат обработки"
          },
          "500": {
            "description": "101: API-токен отсутствует, мерчант не найден/не активен.; 104: Order ID is already being processed.; 500: Ошибка платёжного провайдера. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400: Не переданы order_id / card_pan / card_expire / card_cvv, карта просрочена или Order cannot be processed, current status: … Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404: Order not found.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/ecom/status": {
      "get": {
        "summary": "ECOM — статус платежа",
        "tags": [
          "ECOM"
        ],
        "parameters": [
          {
            "name": "order_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "success, status, order_status, transaction_id"
          },
          "500": {
            "description": "101: API-токен отсутствует, мерчант не найден/не активен. Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "400: order_id is required. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "404: Order not found / ECOM transaction not found.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v2/order/create": {
      "post": {
        "summary": "SberPay QR — создание ордера",
        "description": "Создание ордера с cred_type = 3 (банковский счёт). Возвращает cred_url, cred_data.emvco и foreign_amount.",
        "tags": [
          "SberPay QR"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "order_id",
                  "customer_id",
                  "amount",
                  "cred_type"
                ],
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "customer_id": {
                    "type": "string",
                    "description": "Постоянный идентификатор плательщика. Один плательщик — одно значение во всех платежах."
                  },
                  "submerchant_id": {
                    "type": "string",
                    "description": "Постоянный Merchant ID конечного мерча. Должен совпадать с external_id зарегистрированного субмерчанта.",
                    "example": "shop_alpha"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "cred_type": {
                    "type": "integer",
                    "example": 3
                  },
                  "return_url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешное создание ордера"
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "102: Сумма ниже минимальной в обработчике подбора. В общем потоке v1/v2/v4 предварительная проверка возвращает 106.; 103: Превышена максимальная сумма; customer_id is required; Customer is not allowed; Customer is blocked; submerchant_id is required / is not registered.; 105: Invalid cred_type — неверный тип реквизитов.; 106: Нет подходящих реквизитов/провайдера, сумма ниже минимума, субмерчант временно отключён (Merchant is temporary disabled), ошибка создания/проверки ордера. Возможен текст отказа провайдера.; 1011: Merchant's USDT rate not found — курс мерчанта не настроен. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "409": {
            "description": "104: Order ID already exists / Order ID is already being processed — дубликат или параллельное создание. Перед повтором проверьте статус.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "109: Отказ при подборе/резервировании: клиент не подходит, реквизит или трейдер занят/отключён, изменились лимиты, маршрут, интервал или доступный депозит. Итоговый отказ после повторного подбора/каскада может быть 106.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "110: Invalid lifetime — некорректное время жизни ордера. Текущий HTTP-статус для этого кода — 404.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v2/order/status": {
      "post": {
        "summary": "SberPay QR — статус ордера",
        "tags": [
          "SberPay QR"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "type": "string"
                  },
                  "transaction_id": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Статус ордера"
          },
          "401": {
            "description": "101: API-токен отсутствует; мерчант не найден или не активен (API token is required / Merchant not found or not active).",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "403": {
            "description": "403: IP address is not allowed — IP отправителя отсутствует в разрешённом списке мерчанта.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "106: Order not found — ордер мерчанта не найден (HTTP 400).; 107: Order ID or Transaction ID is required. Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "apiKeyAuth": []
          }
        ]
      }
    },
    "/api/v1/health_check": {
      "get": {
        "summary": "Health Check",
        "description": "Проверка доступности API",
        "tags": [
          "System"
        ],
        "responses": {
          "200": {
            "description": "API доступен",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Невалидный JSON: status=error, error_code=400, error_description=\"Invalid JSON: …\". / Invalid JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "description": "Внутренняя ошибка; исключение без бизнес-кода возвращает код 0. / Internal error; uncoded exceptions return code 0.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    },
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Route not found для пути, не зарегистрированного под выбранным HTTP-методом.",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    }
                  ]
                }
              }
            }
          },
          "501": {
            "description": "Method not implemented: для этого HTTP-метода нет маршрутов.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoutingApiError"
                }
              }
            }
          },
          "default": {
            "description": "Неизвестная ошибка: проверяйте HTTP и JSON. Код зависит от метода; текст может содержать динамические значения. ECOM create/process могут передавать HTTP 4xx/5xx провайдера. См. https://doc.pspay.io/#errors",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/MerchantApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RouterApiError"
                    },
                    {
                      "$ref": "#/components/schemas/EcomApiError"
                    },
                    {
                      "$ref": "#/components/schemas/UploadApiError"
                    },
                    {
                      "$ref": "#/components/schemas/RoutingApiError"
                    },
                    {
                      "$ref": "#/components/schemas/InternalApiError"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-TOKEN"
      }
    },
    "schemas": {
      "MerchantApiError": {
        "type": "object",
        "required": [
          "status",
          "code",
          "error_message"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "code": {
            "type": "integer",
            "description": "Business error code; endpoint-specific, distinct from HTTP status."
          },
          "error_message": {
            "type": "string"
          }
        }
      },
      "RouterApiError": {
        "type": "object",
        "required": [
          "status",
          "error_code",
          "error_description"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "error_code": {
            "type": "integer"
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "EcomApiError": {
        "type": "object",
        "required": [
          "success",
          "error_code",
          "error"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "enum": [
              false
            ]
          },
          "error_code": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "error"
            ]
          },
          "response_time": {
            "type": "number"
          }
        }
      },
      "UploadApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "InternalApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        }
      },
      "RoutingApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "requested_uri": {
            "type": "string"
          },
          "requested_method": {
            "type": "string"
          }
        }
      }
    }
  }
}
