{
  "$schema": "https://ap2.dev/schemas/payment/v1",
  "protocolVersion": "1.0",
  "name": "Ghost AP2 Agent Payment Protocol",
  "description": "Autonomous financial transaction protocol for Ghost — enables Ghost to negotiate, authorize, and execute payments when delegating tasks to external paid agents or receiving payments for providing its capabilities.",
  "agent": {
    "id": "ghost-ai-personal-intelligence",
    "name": "Ghost",
    "role": "consumer_and_provider"
  },
  "wallet": {
    "type": "custodial",
    "description": "Ghost manages a user-controlled wallet for micro-transactions with external agents. All transactions require explicit user approval.",
    "currencies": ["USD", "EUR", "GBP", "GHS"],
    "paymentMethods": [
      {
        "type": "apple_pay",
        "platforms": ["ios"],
        "description": "Apple Pay integration for iOS in-app agent payments"
      },
      {
        "type": "google_pay",
        "platforms": ["android"],
        "description": "Google Pay integration for Android in-app agent payments"
      },
      {
        "type": "prepaid_credits",
        "platforms": ["ios", "android"],
        "description": "Pre-purchased Ghost credits for micro-transactions"
      }
    ]
  },
  "pricing": {
    "asProvider": {
      "model": "free",
      "description": "Ghost's on-device capabilities are free — no per-use charge for local inference, memory, or voice.",
      "capabilities": {
        "conversation": {"cost": 0, "unit": "request"},
        "memory_store": {"cost": 0, "unit": "request"},
        "memory_query": {"cost": 0, "unit": "request"},
        "stt": {"cost": 0, "unit": "minute"},
        "tts": {"cost": 0, "unit": "character"},
        "reasoning": {"cost": 0, "unit": "request"}
      }
    },
    "asConsumer": {
      "budgetLimits": {
        "perTransaction": {"max": 5.00, "currency": "USD"},
        "perDay": {"max": 20.00, "currency": "USD"},
        "perMonth": {"max": 100.00, "currency": "USD"}
      },
      "approvalPolicy": {
        "autoApprove": false,
        "autoApproveThreshold": 0.10,
        "requiresBiometric": true,
        "description": "Transactions below $0.10 can be auto-approved. All others require user biometric confirmation."
      }
    }
  },
  "transactionFlow": {
    "steps": [
      {
        "step": 1,
        "name": "discovery",
        "description": "Ghost discovers external agent and reads OASF pricing"
      },
      {
        "step": 2,
        "name": "quote",
        "description": "Ghost requests a cost estimate for the specific task"
      },
      {
        "step": 3,
        "name": "user_approval",
        "description": "Ghost presents cost to user and requests approval"
      },
      {
        "step": 4,
        "name": "escrow",
        "description": "Payment held in escrow during task execution"
      },
      {
        "step": 5,
        "name": "execution",
        "description": "External agent executes the delegated task"
      },
      {
        "step": 6,
        "name": "verification",
        "description": "Ghost verifies task completion and quality"
      },
      {
        "step": 7,
        "name": "settlement",
        "description": "Payment released from escrow to provider agent"
      }
    ]
  },
  "disputes": {
    "enabled": true,
    "window": "24h",
    "resolution": "automatic_refund_on_failure",
    "escalation": "user_decision"
  },
  "audit": {
    "enabled": true,
    "storage": "on_device",
    "retention": "365_days",
    "exportFormats": ["json", "csv"],
    "description": "Complete transaction history stored locally with full audit trail"
  },
  "compliance": {
    "pci_dss": "not_applicable",
    "note": "Ghost uses platform payment APIs (Apple Pay, Google Pay) — does not store card data"
  }
}
