{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/x402-paid-canary-receipt.v1.json",
  "title": "Agoragentic x402 Paid Canary Receipt",
  "description": "Receipt-shaped evidence for an owner-approved x402 paid-edge canary. The schema records canary proof metadata only; it does not grant wallet custody, trigger settlement, publish a listing, expose private ECF context, or mutate trust.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "receipt_type",
    "receipt_id",
    "payment_protocol",
    "network",
    "asset",
    "amount_usdc",
    "status",
    "x402_flow",
    "evidence_hash",
    "receipt_policy",
    "public_boundary"
  ],
  "properties": {
    "schema": {
      "const": "agoragentic.x402-paid-canary-receipt.v1"
    },
    "receipt_type": {
      "const": "x402_paid_canary_receipt"
    },
    "receipt_id": {
      "type": "string"
    },
    "listing_id": {
      "type": ["string", "null"]
    },
    "endpoint_url": {
      "type": ["string", "null"]
    },
    "payment_protocol": {
      "const": "x402"
    },
    "network": {
      "type": "string",
      "enum": ["base", "solana", "polygon", "arbitrum", "world", "unknown"]
    },
    "asset": {
      "type": "string"
    },
    "amount_usdc": {
      "type": "string",
      "pattern": "^[0-9]+(\\.[0-9]+)?$"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending_owner_approval",
        "passed",
        "failed",
        "blocked",
        "refunded",
        "insufficient_evidence"
      ]
    },
    "facilitator": {
      "type": "string",
      "enum": ["coinbase_cdp", "agoragentic", "external", "unknown"]
    },
    "x402_flow": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "unpaid_request_sent",
        "http_402_seen",
        "payment_payload_submitted",
        "facilitator_verified",
        "paid_retry_completed",
        "receipt_header_seen"
      ],
      "properties": {
        "unpaid_request_sent": { "type": "boolean" },
        "http_402_seen": { "type": "boolean" },
        "payment_payload_submitted": { "type": "boolean" },
        "facilitator_verified": { "type": "boolean" },
        "paid_retry_completed": { "type": "boolean" },
        "receipt_header_seen": { "type": "boolean" }
      }
    },
    "evidence_hash": {
      "type": "string",
      "pattern": "^sha256:"
    },
    "receipt_policy": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "receipt_required",
        "canary_public_summary_only"
      ],
      "properties": {
        "receipt_required": { "const": true },
        "canary_public_summary_only": { "type": "boolean" }
      }
    },
    "public_boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "canary_receipt_only",
        "wallet_custody_granted",
        "settlement_triggered_by_schema",
        "private_ecf_context_exposed",
        "marketplace_listing_published",
        "trust_mutated"
      ],
      "properties": {
        "canary_receipt_only": { "const": true },
        "wallet_custody_granted": { "const": false },
        "settlement_triggered_by_schema": { "const": false },
        "private_ecf_context_exposed": { "const": false },
        "marketplace_listing_published": { "const": false },
        "trust_mutated": { "const": false }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
