{
  "generated_at": "2026-06-12T22:05:57.103Z",
  "system": {
    "id": "topolo-pay",
    "name": "Topolo Pay",
    "slug": "topolo-pay",
    "kind": "application",
    "summary": "Payment worker handling orders, webhooks, admin APIs, and static-asset-backed application behavior.",
    "aliases": [],
    "lifecycle": "active",
    "last_verified": "2026-06-03",
    "owners": [
      "commerce"
    ],
    "repo_paths": [],
    "external_repo_paths": [
      "Apps/business/TopoloPay"
    ],
    "service_ids": [
      "srv_DJInUxp0dLLi"
    ],
    "visibility": "public",
    "api_contract": {
      "type": "curated",
      "source": "PlatformApplications/TopoloDocs/src/content/public/applications/pay.mdx",
      "notes": "Canonical public and internal docs cover the payment worker, local webhook boundary, Nexus-routed outbound payment operations, the authenticated `GET /api/widget` live-workspace endpoint for TopoloOne, code-exchange-only admin SSO with in-memory access-token handling, and the worker-owned `/login` redirect that must run before the SPA fallback. TopoloPay resolves its environment-specific Auth service id from the Auth-owned service slug `topolo-pay` at runtime and exposes that identity through `GET /api/service-identity`; concrete production or staging `srv_*` ids are not app source constants. TopoloPay is also the only Stripe-mutating service for TopoloP2P settlement batches; P2P submits typed settlement requests to Pay and receives Pay status callbacks. Staging deploys build the admin bundle with `npm run build:admin:staging` and require explicit `AUTH_API_URL`, `NEXUS_GATEWAY_URL`, and `PAY_APP_URL` bindings so the staging worker fails closed instead of falling back to production hosts."
    },
    "primary_hosts": [
      "https://pay.topolo.app",
      "https://pay.topolo.app",
      "https://pay.stg.topolo.us"
    ],
    "doc_paths": [
      "applications/pay",
      "internal/apps/pay"
    ],
    "security_assurance": {
      "risk_tier": "critical",
      "auth_boundary": "Topolo Auth service access with Pay-owned financial workflow authorization. Pay admin handlers must run behind shared Auth middleware context; missing admin auth context fails closed instead of minting a local mock finance/admin user, and protected bearer-token authorization must validate with Auth instead of locally decoding JWT claims from a Worker secret.",
      "tenant_isolation": "organization_scoped",
      "external_inputs": [
        "browser",
        "api",
        "callback",
        "webhook"
      ],
      "sensitive_data": [
        "identity",
        "org_data",
        "payment",
        "telemetry"
      ],
      "last_security_review": "2026-04-30",
      "security_review_status": "reviewed",
      "pentest_status": "passed",
      "evidence_doc": "internal/apps/pay"
    },
    "data_privacy": {
      "classification": "restricted",
      "sensitive_data_classes": [
        "identity",
        "organization",
        "payment",
        "telemetry"
      ],
      "storage_locations": [
        "d1",
        "durable_object",
        "external_provider",
        "kv",
        "r2"
      ],
      "encryption_at_rest": "application_layer_required",
      "encryption_in_transit": "https_only",
      "key_management": "versioned_platform_key_required",
      "retention_policy": "partial",
      "deletion_export_status": "planned",
      "logging_redaction_status": "needs_review",
      "privacy_review_status": "reviewed",
      "enterprise_ready": false,
      "evidence_doc": "internal/apps/pay"
    },
    "dependencies": [
      "topolo-auth",
      "topolo-nexus",
      "topolo-p2p",
      "applications-packages"
    ],
    "bugfix_policy": {
      "tier": "act",
      "preferred_agent": "either",
      "require_validator": true
    },
    "public_hub_url": "/systems/topolo-pay",
    "internal_hub_url": null,
    "application_api_url": "/reference/apps/topolo-pay",
    "generated_openapi_url": null,
    "machine_urls": {
      "system": "/machine/systems/topolo-pay.json",
      "application": "/machine/applications/topolo-pay.json"
    }
  },
  "docs": {
    "public": [
      {
        "id": "applications/commerce",
        "title": "TopoloCommerce",
        "summary": "Public overview of the multi-vertical commerce platform for venue operations, guest runtimes, and staff execution.",
        "audience": "public",
        "tags": [
          "commerce",
          "venues",
          "kiosk"
        ],
        "url": "/applications/commerce",
        "last_verified": "2026-05-13"
      },
      {
        "id": "applications/pay",
        "title": "Topolo Pay",
        "summary": "Public overview of the payment worker that handles orders, refunds, and payment operations.",
        "audience": "public",
        "tags": [
          "payments",
          "orders",
          "worker"
        ],
        "url": "/applications/pay",
        "last_verified": "2026-05-14"
      }
    ],
    "internal": [],
    "runbooks": []
  },
  "authority": {
    "owners": [
      "commerce"
    ],
    "repo_paths": [],
    "service_ids": [
      "srv_DJInUxp0dLLi"
    ],
    "dependencies": [
      "topolo-auth",
      "topolo-nexus",
      "topolo-p2p",
      "applications-packages"
    ],
    "aliases": []
  },
  "interfaces": {
    "contract_type": "curated",
    "contract_source": "PlatformApplications/TopoloDocs/src/content/public/applications/pay.mdx",
    "contract_source_exists": false,
    "openapi": null,
    "readme": null
  },
  "auth": {
    "depends_on_topolo_auth": true,
    "api_key_scopes": [
      {
        "id": "aks_pay_analytics_read",
        "name": "analytics.read",
        "description": "View payment analytics",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_audit_read",
        "name": "audit.read",
        "description": "View payment audit logs",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_customers_read",
        "name": "customers.read",
        "description": "View customer payment profiles",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_customers_write",
        "name": "customers.write",
        "description": "Manage customer payment methods",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_dashboard_read",
        "name": "dashboard.read",
        "description": "View TopoloPay dashboards and operational summaries",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_invoices_read",
        "name": "invoices.read",
        "description": "View invoices and billing",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_invoices_write",
        "name": "invoices.write",
        "description": "Create and manage invoices",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_merchants_read",
        "name": "merchants.read",
        "description": "View merchant payment profiles and configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_merchants_write",
        "name": "merchants.write",
        "description": "Manage merchant payment profiles and configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_payments_create",
        "name": "payments.create",
        "description": "Create payment or checkout sessions",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_payments_read",
        "name": "payments.read",
        "description": "Read payment and charge state",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_reports_read",
        "name": "reports.read",
        "description": "View payment reports and analytics",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_settings_read",
        "name": "settings.read",
        "description": "View payment gateway settings",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_settings_write",
        "name": "settings.write",
        "description": "Configure payment processing",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_settlements_write",
        "name": "settlements.write",
        "description": "Accept TopoloP2P settlement batches",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_transactions_read",
        "name": "transactions.read",
        "description": "View payment transactions",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_transactions_refund",
        "name": "transactions.refund",
        "description": "Refund transactions",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_transactions_write",
        "name": "transactions.write",
        "description": "Process payments and refunds",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_venues_read",
        "name": "venues.read",
        "description": "View venue configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      },
      {
        "id": "aks_pay_venues_write",
        "name": "venues.write",
        "description": "Manage venue configuration",
        "resourcePattern": null,
        "kind": "api_key_scope"
      }
    ],
    "service_permissions": [
      {
        "id": "perm_pay_analytics_read",
        "name": "analytics:read",
        "description": "View payment analytics",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_audit_read",
        "name": "audit:read",
        "description": "View payment audit logs",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_customers_read",
        "name": "customers:read",
        "description": "View customer payment profiles",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_customers_write",
        "name": "customers:write",
        "description": "Manage customer payment methods",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_dashboard_read",
        "name": "dashboard:read",
        "description": "View TopoloPay dashboards and operational summaries",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_invoices_read",
        "name": "invoices:read",
        "description": "View invoices and billing",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_invoices_write",
        "name": "invoices:write",
        "description": "Create and manage invoices",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_merchants_read",
        "name": "merchants:read",
        "description": "View merchant payment profiles and configuration",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_merchants_write",
        "name": "merchants:write",
        "description": "Manage merchant payment profiles and configuration",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_payments_create",
        "name": "payments:create",
        "description": "Create payment or checkout sessions",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_payments_read",
        "name": "payments:read",
        "description": "Read payment and charge state",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_reports_read",
        "name": "reports:read",
        "description": "View payment reports and analytics",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_settings_read",
        "name": "settings:read",
        "description": "View payment gateway settings",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_settings_write",
        "name": "settings:write",
        "description": "Configure payment processing",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_settlements_write",
        "name": "settlements:write",
        "description": "Accept TopoloP2P settlement batches",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_transactions_read",
        "name": "transactions:read",
        "description": "View payment transactions",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_transactions_refund",
        "name": "transactions:refund",
        "description": "Refund transactions",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_transactions_write",
        "name": "transactions:write",
        "description": "Process payments and refunds",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_venues_read",
        "name": "venues:read",
        "description": "View venue configuration",
        "resourcePattern": null,
        "kind": "permission"
      },
      {
        "id": "perm_pay_venues_write",
        "name": "venues:write",
        "description": "Manage venue configuration",
        "resourcePattern": null,
        "kind": "permission"
      }
    ]
  },
  "runtime": {
    "primary_hosts": [
      "https://pay.topolo.app",
      "https://pay.topolo.app",
      "https://pay.stg.topolo.us"
    ],
    "repo_entries": [],
    "wrangler_surfaces": [],
    "packages": []
  },
  "data": {
    "env_vars": [],
    "bindings": [],
    "queue_bindings": [],
    "storage_kinds": [],
    "workflow_signals": []
  },
  "deployment": {
    "commands": [],
    "routes": [],
    "environments": [],
    "assets_directories": [],
    "observability_enabled": false
  },
  "debugging": {
    "failure_modes": [
      "No wrangler.toml surface was discovered under the registered repo paths.",
      "The registered contract source is missing: PlatformApplications/TopoloDocs/src/content/public/applications/pay.mdx",
      "Neither OpenAPI nor README-derived interface detail was found."
    ],
    "entrypoints": [
      "PlatformApplications/TopoloDocs/src/content/public/applications/pay.mdx"
    ]
  }
}