{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentweb.us/.well-known/payment-artifact.schema.json",
  "title": "AgentWeb Payment Artifact",
  "type": "object",
  "required": [
    "payment_artifact_id",
    "mode",
    "provider",
    "principal",
    "scope",
    "amount",
    "currency",
    "state",
    "created_at"
  ],
  "properties": {
    "payment_artifact_id": { "type": "string" },
    "setup_session_id": { "type": "string" },
    "mode": {
      "type": "string",
      "enum": [
        "agent_pays_agentweb",
        "agent_pays_business_through_map",
        "business_pays_agentweb"
      ]
    },
    "provider": {
      "type": "string",
      "enum": [
        "stripe_acp",
        "stripe_shared_payment_token",
        "stripe_machine_payments",
        "stripe_checkout",
        "stripe_billing",
        "stripe_invoice",
        "manual"
      ]
    },
    "principal": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": { "type": "string", "enum": ["user", "business", "agent", "enterprise_account"] },
        "id": { "type": "string" },
        "authority_reference": { "type": "string" }
      }
    },
    "scope": { "type": "array", "items": { "type": "string" } },
    "amount": { "type": "number" },
    "currency": { "type": "string" },
    "state": {
      "type": "string",
      "enum": ["quote", "pending", "authorized", "paid", "failed", "cancelled", "refunded"]
    },
    "expires_at": { "type": "string", "format": "date-time" },
    "receipt_url": { "type": "string" },
    "revocation_url": { "type": "string" },
    "verification_artifact_id": { "type": "string" },
    "created_at": { "type": "string", "format": "date-time" }
  }
}
