{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dnsofmoney-com/json-schema/dnsofmoney-com-ap2-purchase-request-schema.json",
  "title": "AP2PurchaseRequest",
  "description": "An inbound AP2 purchase: the user's IntentMandate + the settled-on-XRPL proof.",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dnsofmoney-com-openapi.json#/components/schemas/AP2PurchaseRequest",
  "properties": {
    "intent": {
      "$ref": "#/$defs/IntentMandate"
    },
    "alias": {
      "type": "string",
      "title": "Alias",
      "description": "The pay: alias being paid (the merchant/payee)."
    },
    "amount": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
        }
      ],
      "title": "Amount",
      "description": "Amount paid, in the asset's display unit (XRP)."
    },
    "currency": {
      "type": "string",
      "title": "Currency",
      "description": "Settlement asset. XRP (XRPL) for v1.",
      "default": "XRP"
    },
    "tx_hash": {
      "type": "string",
      "title": "Tx Hash",
      "description": "The already-settled XRPL transaction hash (verified read-only)."
    },
    "merchant_name": {
      "type": "string",
      "title": "Merchant Name",
      "description": "Merchant name carried in the CartMandate.",
      "default": "DNS of Money"
    }
  },
  "type": "object",
  "required": [
    "intent",
    "alias",
    "amount",
    "tx_hash"
  ],
  "$defs": {
    "IntentMandate": {
      "properties": {
        "natural_language_description": {
          "type": "string",
          "title": "Natural Language Description"
        },
        "intent_expiry": {
          "type": "string",
          "title": "Intent Expiry"
        },
        "user_cart_confirmation_required": {
          "type": "boolean",
          "title": "User Cart Confirmation Required",
          "default": true
        },
        "merchants": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Merchants"
        },
        "skus": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Skus"
        },
        "requires_refundability": {
          "type": "boolean",
          "title": "Requires Refundability",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "natural_language_description",
        "intent_expiry"
      ],
      "title": "IntentMandate"
    }
  }
}