{
  "service": "APKassa",
  "title": "APKASSA Умная касса для бизнеса",
  "base": "https://apkassa.ru",
  "version": "1.0",
  "locale": "ru-RU",
  "certificate": "2026688570",
  "application": "2026688152",
  "registered": "2026-09-18",
  "filed": "2026-07-04",
  "developer": {
    "name": "Бирич Максим Владимирович",
    "country": "RU",
    "role": "author_and_rights_holder"
  },
  "docs": {
    "handbook": "https://apkassa.ru/book.php",
    "handbook_html": "https://apkassa.ru/docs/apkassa-handbook.html",
    "llms": "https://apkassa.ru/llms.txt",
    "llms_docs": "https://apkassa.ru/docs/apkassa-llms.txt",
    "this_file": "https://apkassa.ru/docs/apkassa-api.json",
    "certificate_image": "https://apkassa.ru/docs/apkassa-certificate.jpg",
    "faq": "https://apkassa.ru/FAQ/faq.php",
    "description": "https://apkassa.ru/FAQ/description.php",
    "store": "https://apkassa.ru/store.php"
  },
  "auth": {
    "public_payment": {
      "headers": ["X-API-Key", "Authorization: Bearer <token>"],
      "body_or_query": ["api_key"],
      "invalid": {"http": 403, "body": {"success": false, "error": "Неверный API-ключ"}},
      "where_to_get": "/man/?page=opencart_payment → generate_key"
    },
    "cabinet": {
      "session": ["manager_logged_in", "manager_org_id", "manager_role"],
      "roles": ["admin", "superadmin", "manager"],
      "unauth": 401
    }
  },
  "tenancy": {
    "org_id": "обязателен для данных организации",
    "cash_register_id": "дополнительный фильтр кассира"
  },
  "idempotency": {
    "payment": ["org_id", "opencart_order_id"]
  },
  "agent_rules": [
    "Не выдумывать ключи и секреты интеграций",
    "Не обещать оплату без настроенной ЮKassa",
    "Товары без фото на APSALLE не выгружать как полноценные объявления",
    "Мутации только с ключом или сессией менеджера",
    "Не удалять существующий рабочий код"
  ],
  "endpoints": [
    {
      "id": "create_payment",
      "method": "POST",
      "path": "/api/apflower_payment.php",
      "auth": "public_payment",
      "content_type": "application/json",
      "cors": true,
      "description": "Создать заказ в APKassa и платёж ЮKassa (виджет или redirect) для OpenCart / apflower / sushiap.",
      "body": {
        "org_id": {"type": "int", "required": false, "note": "если пусто — из ключа"},
        "opencart_order_id": {"type": "int", "required": true, "aliases": ["external_order_id"]},
        "amount": {"type": "number", "required": true, "aliases": ["total"]},
        "phone": {"type": "string", "required": true, "min_digits": 10, "aliases": ["client_phone"]},
        "email": {"type": "string", "required": false},
        "return_url": {"type": "string", "required": false},
        "embedded": {"type": "bool", "required": false, "note": "1 = виджет ЮKassa"},
        "items": {
          "type": "array",
          "required": true,
          "item": {"name": "string", "price": "number", "qty": "int", "id": "int?"}
        },
        "description": {"type": "string", "required": false},
        "opencart_callback_url": {"type": "string", "required": false}
      },
      "errors": [
        "Не передан org_id",
        "Не передан opencart_order_id",
        "Сумма не указана",
        "Корзина пуста",
        "Телефон обязателен для ЮKassa",
        "ЮKassa не настроена"
      ],
      "success_fields": ["success", "apkassa_order_id", "payment_id", "confirmation_token", "confirmation_url"]
    },
    {
      "id": "payment_status",
      "method": ["GET", "POST"],
      "path": "/api/apflower_payment_status.php",
      "auth": "public_payment",
      "description": "Статус оплаты внешнего заказа. При необходимости сверяет ЮKassa и помечает paid.",
      "params": {
        "opencart_order_id": {"required": true, "aliases": ["order_id"]},
        "org_id": {"required": false},
        "api_key": {"required": false, "note": "если нет заголовка"}
      },
      "success_fields": ["success", "paid", "payment_status", "apkassa_order_id", "order_number", "total"]
    },
    {
      "id": "opencart_payment_cabinet",
      "method": ["GET", "POST"],
      "path": "/man/api/opencart_payment_api.php",
      "auth": "cabinet",
      "actions": ["get_config", "save_config", "generate_key", "test_yookassa", "test_payment"],
      "org_param": "org_id"
    },
    {
      "id": "opencart_connections",
      "method": ["GET", "POST"],
      "path": "/man/api/opencart_connections.php",
      "auth": "cabinet",
      "actions": ["list", "get", "save", "test", "delete"],
      "note": "в list/get секреты магазинов обнуляются"
    },
    {
      "id": "app_store_api",
      "method": ["GET", "POST"],
      "path": "/man/api/app_store_api.php",
      "auth": "cabinet",
      "actions": ["list", "save", "delete"],
      "save": "multipart/form-data, поле apk_file (для APK); HTML-книга сидируется отдельно"
    },
    {
      "id": "app_store_download",
      "method": "GET",
      "path": "/download_app.php",
      "auth": "token",
      "params": {
        "token": "download_token приложения",
        "view": "1 — показать inline",
        "download": "1 — принудительно attachment"
      },
      "handbook_token": "apkassa-handbook-2026688570",
      "aliases": ["/man/download_apk.php"]
    },
    {
      "id": "ofd_reports",
      "method": ["GET", "POST"],
      "path": "/man/api/ofd_reports_api.php",
      "auth": "cabinet",
      "actions": ["kkts", "report"]
    },
    {
      "id": "reconciliation",
      "method": ["GET", "POST"],
      "path": "/man/api/reconciliation_api.php",
      "auth": "cabinet",
      "aliases": ["/api/reconciliation_api.php"]
    },
    {
      "id": "sber_webhook",
      "method": "POST",
      "path": "/api/sber/webhook.php",
      "auth": "none_or_bank",
      "description": "Приём webhook Сбера, пишет sber_webhook_log"
    },
    {
      "id": "sber_test",
      "method": "GET",
      "path": "/api/sber/test_connection.php",
      "auth": "cabinet_or_keys"
    },
    {
      "id": "shop_create_order",
      "method": "POST",
      "path": "/shop/api/create_order.php",
      "auth": "public_shop",
      "description": "Заказ с витрины /shop в orders + order_items"
    },
    {
      "id": "consume_ingredients",
      "method": "POST",
      "path": "/api/consume_ingredients.php",
      "auth": "internal_or_session",
      "description": "Списание ингредиентов техкарты при сборке/готовности заказа"
    }
  ],
  "pages": {
    "cabinet_query": "/man/?page={page}",
    "list": [
      "dashboard", "selfemployed", "profile", "orders", "sales", "customers", "products",
      "cash", "app_store", "purchases", "materials", "tech_cards", "expenses", "analytics",
      "payouts", "yookassa", "opencart_payment", "sber_bank", "sber_settings", "employees",
      "employee_tariffs", "schedule", "managers", "organizations", "cashregisters", "users",
      "integrations", "apsalle", "flower_shop", "delivery", "callcenter", "neural_manager",
      "files", "settings"
    ],
    "standalone": [
      "/man/categories.php",
      "/man/import_products_csv.php",
      "/man/ofd_reports.php",
      "/login.php",
      "/store.php",
      "/book.php",
      "/shop/",
      "/kiosk/",
      "/kassa1/",
      "/povar/",
      "/courier/",
      "/senior/",
      "/buh/",
      "/tehnik/"
    ]
  },
  "related": {
    "apflower": "https://apflower.ru",
    "sushiap": "https://sushiap.ru",
    "apdostavka": "https://apdostavka.ru",
    "apsalle": "https://apsalle.ru"
  }
}
