{
  "openapi": "3.1.0",
  "info": {
    "title": "Payteez Merchant & Payout API",
    "version": "1.0.0",
    "description": "Production base URL: https://payteez.com. Server-to-server POST JSON only. HMAC-SHA256 of time + LF + nonce + LF + POST + LF + path + LF + exact raw UTF-8 JSON. Four headers are required together. Keys for shops and payouts are separate. See https://payteez.com/docs/authentication. Do not invent refund, card-acquiring, cancellation or exchange endpoints: these are not part of this public API."
  },
  "servers": [
    {
      "url": "https://payteez.com"
    }
  ],
  "security": [
    {
      "PayteezId": [],
      "PayteezTime": [],
      "PayteezNonce": [],
      "PayteezSignature": []
    }
  ],
  "tags": [
    {
      "name": "Приём платежей"
    },
    {
      "name": "Выплаты"
    }
  ],
  "paths": {
    "/api/payout/v1/quote": {
      "post": {
        "operationId": "calculatePayout",
        "tags": [
          "Выплаты"
        ],
        "summary": "Расчёт комиссии выплаты",
        "description": "Подписанный расчёт без списания. Нужны разрешение transfer или withdraw согласно action и разрешённый IP. Расчёт не фиксирует тариф. Передайте полученный total в запрос выплаты; при изменении итога получите HTTP 409 без списания. Подробности: /docs/fees.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayoutQuote"
              },
              "example": {
                "action": "transfer",
                "currency": "USD",
                "amount": "10.00"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PayoutCalculation"
                },
                "example": {
                  "action": "transfer",
                  "currency": "USD",
                  "recipientAmount": "10.00",
                  "fee": "0.05",
                  "total": "10.05"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/merchant/v1/orders": {
      "post": {
        "operationId": "createMerchantOrder",
        "tags": [
          "Приём платежей"
        ],
        "summary": "Создать счёт",
        "description": "Создаёт счёт для оплаты из кошелька Payteez. Требуется ключ подтверждённого и одобренного магазина. Перенаправьте покупателя на checkoutUrl. Счёт действует 30 минут. URL возврата и обработчика берутся из настроек магазина; передавать их в этом запросе нельзя.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrder"
              },
              "example": {
                "requestId": "shop-order-123-attempt-1",
                "orderId": "ORDER-123",
                "amount": "10.00",
                "currency": "USD",
                "description": "Заказ №123"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "example": {
                  "id": "8ce029ca-bec2-4c81-a2c1-d35f1af9329e",
                  "orderId": "ORDER-123",
                  "status": "pending",
                  "amount": "10.00",
                  "currency": "USD",
                  "test": false,
                  "expiresAt": 1796092200000,
                  "checkoutUrl": "https://payteez.com/merchant-pay?token=EXAMPLE_TOKEN",
                  "fee": "0.05",
                  "feePayer": "merchant",
                  "payerAmount": "10.00",
                  "merchantAmount": "9.95"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/merchant/v1/status": {
      "post": {
        "operationId": "getMerchantOrder",
        "tags": [
          "Приём платежей"
        ],
        "summary": "Статус счёта",
        "description": "Возвращает только счёт, принадлежащий этому магазину. Используйте тот же ключ магазина. Проверяйте статус после неопределённого результата или при сверке уведомлений.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderStatus"
              },
              "example": {
                "id": "8ce029ca-bec2-4c81-a2c1-d35f1af9329e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                },
                "example": {
                  "id": "8ce029ca-bec2-4c81-a2c1-d35f1af9329e",
                  "orderId": "ORDER-123",
                  "status": "paid",
                  "amount": "10.00",
                  "currency": "USD",
                  "test": false,
                  "expiresAt": 1796092200000,
                  "checkoutUrl": "https://payteez.com/merchant-pay?token=EXAMPLE_TOKEN",
                  "fee": "0.05",
                  "feePayer": "merchant",
                  "payerAmount": "10.00",
                  "merchantAmount": "9.95"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/payout/v1/balance": {
      "post": {
        "operationId": "getPayoutBalance",
        "tags": [
          "Выплаты"
        ],
        "summary": "Баланс API",
        "description": "Возвращает балансы владельца API-ключа по валютам. Нужен отдельный одобренный API-пользователь, разрешение balance и разрешённый IP сервера.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {},
                "required": []
              },
              "example": {}
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                },
                "example": {
                  "balances": [
                    {
                      "currency": "USD",
                      "amount": "100.00"
                    },
                    {
                      "currency": "RUB",
                      "amount": "0.00"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/payout/v1/transfer": {
      "post": {
        "operationId": "transferToWallet",
        "tags": [
          "Выплаты"
        ],
        "summary": "Перевод в Payteez",
        "description": "Переводит средства из кошелька владельца API в кошелёк получателя Payteez. Нужны разрешение transfer, разрешённый IP и достаточный баланс. Валюта должна совпадать с валютой лимитов API.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Transfer"
              },
              "example": {
                "requestId": "payout-order-123456",
                "recipient": "P10000001",
                "amount": "10.00",
                "currency": "USD"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                },
                "example": {
                  "id": "1bb3fdd0-667a-4f33-a89a-789780c8fed1",
                  "status": "done",
                  "currency": "USD",
                  "amount": "10.05",
                  "total": "10.05",
                  "fee": "0.05",
                  "recipientAmount": "10.00"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/payout/v1/withdraw": {
      "post": {
        "operationId": "withdrawCrypto",
        "tags": [
          "Выплаты"
        ],
        "summary": "Вывод криптовалюты",
        "description": "Ставит внешнюю криптовыплату в очередь. Нужны разрешение withdraw, разрешённый IP, включённая сеть и достаточный баланс с комиссией. Номер сети берите из «Массовые выплаты → Платёжные системы». Ответ pending не подтверждает отправку в блокчейн.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Withdraw"
              },
              "example": {
                "requestId": "withdraw-order-123456",
                "ticker": "USDTTRC",
                "address": "YOUR_RECIPIENT_ADDRESS",
                "destTag": "",
                "amount": "10"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                },
                "example": {
                  "id": "1bb3fdd0-667a-4f33-a89a-789780c8fed1",
                  "status": "pending",
                  "currency": "USDT",
                  "amount": "11.000000",
                  "total": "11.000000",
                  "fee": "1.000000",
                  "recipientAmount": "10.000000"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/payout/v1/status": {
      "post": {
        "operationId": "getPayoutStatus",
        "tags": [
          "Выплаты"
        ],
        "summary": "Статус выплаты",
        "description": "Возвращает операцию по requestId в пределах этого API-пользователя. Используйте тот же API-ключ, который создал выплату. Отдельное разрешение status не требуется, но ключ должен оставаться активным и одобренным.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayoutStatus"
              },
              "example": {
                "requestId": "withdraw-order-123456"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Успешный ответ. Денежные значения — строки.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Operation"
                },
                "example": {
                  "id": "1bb3fdd0-667a-4f33-a89a-789780c8fed1",
                  "status": "done",
                  "currency": "USDT",
                  "amount": "11.000000",
                  "total": "11.000000",
                  "fee": "1.000000",
                  "recipientAmount": "10.000000"
                }
              }
            }
          },
          "400": {
            "description": "Ошибка параметров или бизнес-ограничение",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Неверная подпись или время",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Доступ, IP или разрешение отклонены",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Объект не найден",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Повтор nonce или конфликт идентификатора",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Тело слишком большое",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Нужен application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Превышена частота запросов",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Ошибка сервера",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "paymentPaid": {
      "post": {
        "summary": "Уведомление на URL обработчика магазина",
        "description": "HMAC-SHA256(secret, exact raw body) in X-Payteez-Signature. No timestamp/nonce headers here. Deduplicate by invoice id. Verify merchantId, invoice id, orderId, exact amount, currency, status and test=false before fulfilling. Up to 10 attempts; respond 2xx after commit. Visual test invoices do not trigger this webhook.",
        "security": [
          {
            "PayteezSignature": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Сохранено, включая повтор уже обработанного уведомления"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PayteezId": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Payteez-Id",
        "description": "Shop ID for merchant endpoints, API-user ID for payouts."
      },
      "PayteezTime": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Payteez-Time",
        "description": "13-digit Unix milliseconds, tolerance 5 minutes."
      },
      "PayteezNonce": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Payteez-Nonce",
        "description": "Fresh 16–100 ASCII letters/digits/underscore/hyphen, including each retry."
      },
      "PayteezSignature": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Payteez-Signature",
        "description": "64 lowercase hex characters, HMAC-SHA256 as documented."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Описание ошибки. Текст может уточняться; ориентируйтесь также на HTTP-статус."
          }
        },
        "required": [
          "error"
        ]
      },
      "CreateOrder": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Сохраните до запроса. Для повтора одной операции используйте прежнее значение.",
            "minLength": 16,
            "maxLength": 100,
            "example": "shop-order-123-attempt-1"
          },
          "orderId": {
            "type": "string",
            "description": "Номер заказа на вашем сайте; уникален при включённой проверке уникальности.",
            "minLength": 1,
            "maxLength": 100,
            "example": "ORDER-123"
          },
          "amount": {
            "type": "string",
            "description": "Положительная сумма строкой с точкой. Точность зависит от валюты; см. /docs/currencies.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "description": {
            "type": "string",
            "description": "Описание для покупателя. Сервер обрезает до 300 символов.",
            "maxLength": 300
          },
          "encryptedParams": {
            "type": "string",
            "description": "Необязательно: base64(IV12 + AES-256-GCM ciphertext + tag16), отдельный ключ параметров магазина.",
            "minLength": 40,
            "maxLength": 12000
          }
        },
        "required": [
          "requestId",
          "orderId",
          "amount",
          "currency"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID счёта Payteez.",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "description": "Номер заказа вашего сайта."
          },
          "status": {
            "type": "string",
            "description": "Статус счёта.",
            "enum": [
              "pending",
              "paid",
              "expired"
            ]
          },
          "amount": {
            "type": "string",
            "description": "Сумма счёта; строка с фиксированной точностью валюты.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "test": {
            "type": "boolean",
            "description": "true только для визуального теста из кабинета."
          },
          "expiresAt": {
            "type": "integer",
            "description": "Срок оплаты: Unix timestamp в миллисекундах.",
            "format": "int64"
          },
          "checkoutUrl": {
            "type": "string",
            "description": "Ссылка на страницу оплаты покупателем.",
            "format": "uri"
          },
          "fee": {
            "type": "string",
            "description": "Зафиксированная комиссия в валюте заказа."
          },
          "feePayer": {
            "type": "string",
            "description": "Кто оплачивает комиссию.",
            "enum": [
              "merchant",
              "client"
            ]
          },
          "payerAmount": {
            "type": "string",
            "description": "Сумма к оплате в валюте заказа."
          },
          "merchantAmount": {
            "type": "string",
            "description": "Зачисление магазину после комиссии."
          }
        },
        "required": [
          "id",
          "orderId",
          "status",
          "amount",
          "currency",
          "test",
          "expiresAt",
          "checkoutUrl",
          "fee",
          "feePayer",
          "payerAmount",
          "merchantAmount"
        ]
      },
      "OrderStatus": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID из ответа создания счёта.",
            "format": "uuid"
          }
        },
        "required": [
          "id"
        ]
      },
      "Balance": {
        "type": "object",
        "properties": {
          "balances": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string",
                  "description": "Код валюты кошелька.",
                  "enum": [
                    "USD",
                    "RUB",
                    "EUR",
                    "BTC",
                    "USDT",
                    "ETH",
                    "BCH",
                    "LTC",
                    "DASH",
                    "XRP",
                    "TON",
                    "BNB",
                    "USDC",
                    "SOL",
                    "TRX",
                    "DOGE"
                  ],
                  "example": "USD"
                },
                "amount": {
                  "type": "string",
                  "description": "Доступный баланс строкой, допускается нулевое значение."
                }
              },
              "required": [
                "currency",
                "amount"
              ]
            }
          }
        },
        "required": [
          "balances"
        ]
      },
      "Transfer": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Сохраните до запроса. Для повтора одной операции используйте прежнее значение.",
            "minLength": 16,
            "maxLength": 80,
            "pattern": "^[A-Za-z0-9_-]+$",
            "example": "shop-order-123-attempt-1"
          },
          "recipient": {
            "type": "string",
            "description": "Номер кошелька получателя Payteez.",
            "pattern": "^P[0-9]+$",
            "example": "P10000001"
          },
          "amount": {
            "type": "string",
            "description": "Положительная сумма строкой с точкой. Точность зависит от валюты; см. /docs/currencies.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "total": {
            "type": "string",
            "description": "Необязательно: total из предварительного расчёта. При изменении суммы HTTP 409 без списания. При повторе принятой операции сохраните исходное тело запроса."
          }
        },
        "required": [
          "requestId",
          "recipient",
          "amount",
          "currency"
        ]
      },
      "Withdraw": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Сохраните до запроса. Для повтора одной операции используйте прежнее значение.",
            "minLength": 16,
            "maxLength": 80,
            "pattern": "^[A-Za-z0-9_-]+$",
            "example": "shop-order-123-attempt-1"
          },
          "ticker": {
            "type": "string",
            "description": "Идентификатор подключённой сети из кабинета. USDTTRC — пример; доступность зависит от настроек.",
            "example": "USDTTRC"
          },
          "address": {
            "type": "string",
            "description": "Адрес в выбранной сети.",
            "example": "YOUR_RECIPIENT_ADDRESS"
          },
          "destTag": {
            "type": "string",
            "description": "Memo / tag получателя. Обязателен для сетей, которые его требуют.",
            "example": ""
          },
          "amount": {
            "type": "string",
            "description": "Положительная сумма строкой с точкой. Точность зависит от валюты; см. /docs/currencies.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "total": {
            "type": "string",
            "description": "Необязательно: total из предварительного расчёта. При изменении суммы HTTP 409 без списания. При повторе принятой операции сохраните исходное тело запроса."
          }
        },
        "required": [
          "requestId",
          "ticker",
          "address",
          "amount"
        ]
      },
      "PayoutStatus": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "description": "Сохраните до запроса. Для повтора одной операции используйте прежнее значение.",
            "minLength": 16,
            "maxLength": 80,
            "pattern": "^[A-Za-z0-9_-]+$",
            "example": "shop-order-123-attempt-1"
          }
        },
        "required": [
          "requestId"
        ]
      },
      "Operation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID финансовой операции Payteez."
          },
          "status": {
            "type": "string",
            "description": "Текущий статус.",
            "enum": [
              "pending",
              "sending",
              "done",
              "cancelled"
            ]
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "amount": {
            "type": "string",
            "description": "Исходное полное списание, включая комиссию, для перевода и внешнего вывода. При cancelled выплата отменена и средства возвращены."
          },
          "total": {
            "type": "string",
            "description": "Полное списание; совпадает с amount."
          },
          "fee": {
            "type": "string",
            "description": "Сохранённая комиссия. Может отсутствовать у старых операций."
          },
          "recipientAmount": {
            "type": "string",
            "description": "Сумма получателю. Может отсутствовать у старых операций."
          }
        },
        "required": [
          "id",
          "status",
          "currency",
          "amount",
          "total"
        ]
      },
      "PaymentEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UUID счёта, ключ устранения повторных уведомлений.",
            "format": "uuid"
          },
          "orderId": {
            "type": "string",
            "description": "Номер заказа сайта."
          },
          "merchantId": {
            "type": "string",
            "description": "ID магазина Payteez."
          },
          "status": {
            "type": "string",
            "const": "paid",
            "description": "Уведомление отправляется после оплаты."
          },
          "amount": {
            "type": "string",
            "description": "Положительная сумма строкой с точкой. Точность зависит от валюты; см. /docs/currencies.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "test": {
            "type": "boolean",
            "description": "Для исполнения реального заказа требуется false."
          },
          "params": {
            "description": "Расшифрованные дополнительные JSON-параметры, если передавались encryptedParams."
          }
        },
        "required": [
          "id",
          "orderId",
          "merchantId",
          "status",
          "amount",
          "currency",
          "test"
        ]
      },
      "PayoutQuote": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "description": "Вид выплаты.",
            "enum": [
              "transfer",
              "withdraw"
            ]
          },
          "amount": {
            "type": "string",
            "description": "Положительная сумма строкой с точкой. Точность зависит от валюты; см. /docs/currencies.",
            "pattern": "^\\d{1,15}(\\.\\d{1,9})?$",
            "maxLength": 40,
            "example": "10.00"
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "ticker": {
            "type": "string",
            "description": "Для withdraw — код сети, например USDTTRC."
          }
        },
        "required": [
          "action",
          "amount"
        ],
        "description": "Для transfer требуется currency; для withdraw требуется ticker. Не резервирует деньги и не проверяет баланс, лимиты API или адрес.",
        "allOf": [
          {
            "if": {
              "properties": {
                "action": {
                  "const": "transfer"
                }
              }
            },
            "then": {
              "required": [
                "currency"
              ]
            }
          },
          {
            "if": {
              "properties": {
                "action": {
                  "const": "withdraw"
                }
              }
            },
            "then": {
              "required": [
                "ticker"
              ]
            }
          }
        ]
      },
      "PayoutCalculation": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string",
            "description": "Вид выплаты.",
            "enum": [
              "transfer",
              "withdraw"
            ]
          },
          "currency": {
            "type": "string",
            "description": "Код валюты кошелька.",
            "enum": [
              "USD",
              "RUB",
              "EUR",
              "BTC",
              "USDT",
              "ETH",
              "BCH",
              "LTC",
              "DASH",
              "XRP",
              "TON",
              "BNB",
              "USDC",
              "SOL",
              "TRX",
              "DOGE"
            ],
            "example": "USD"
          },
          "recipientAmount": {
            "type": "string",
            "description": "Сумма получателю."
          },
          "fee": {
            "type": "string",
            "description": "Комиссия по текущему тарифу."
          },
          "total": {
            "type": "string",
            "description": "Итог к списанию. Передайте total в выплату для защиты от изменения комиссии."
          }
        },
        "required": [
          "action",
          "currency",
          "recipientAmount",
          "fee",
          "total"
        ]
      }
    }
  }
}