{
  "$ref": "#/definitions/receipt-v1",
  "definitions": {
    "receipt-v1": {
      "type": "object",
      "properties": {
        "v": {
          "type": "string",
          "const": "0.1"
        },
        "kind": {
          "type": "string",
          "enum": [
            "spend",
            "earn"
          ],
          "default": "spend"
        },
        "agent": {
          "type": "string"
        },
        "nonce": {
          "type": "integer",
          "minimum": 0
        },
        "ts": {
          "type": "string"
        },
        "policy_v": {
          "type": "string"
        },
        "request": {
          "type": "object",
          "properties": {
            "method": {
              "type": "string"
            },
            "url": {
              "type": "string"
            },
            "body_hash": {
              "type": [
                "string",
                "null"
              ]
            },
            "headers_hash": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          "required": [
            "method",
            "url",
            "body_hash"
          ],
          "additionalProperties": false
        },
        "decision": {
          "type": "string",
          "enum": [
            "allow",
            "deny",
            "rejected"
          ]
        },
        "reason": {
          "type": [
            "string",
            "null"
          ]
        },
        "price": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "amount": {
                  "type": "string"
                },
                "currency": {
                  "type": "string"
                },
                "network": {
                  "type": "string"
                },
                "asset": {
                  "type": "string"
                },
                "fee": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "gross": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "feeBps": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "feeAuthority": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "amount",
                "currency"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "facilitator": {
          "anyOf": [
            {
              "anyOf": [
                {
                  "type": "string",
                  "enum": [
                    "payai",
                    "corbits",
                    "svmacc",
                    "self",
                    "local"
                  ]
                },
                {
                  "type": "string",
                  "format": "uri"
                }
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "tx_sig": {
          "type": [
            "string",
            "null"
          ]
        },
        "payment_requirements_hash": {
          "type": [
            "string",
            "null"
          ]
        },
        "response": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "status": {
                  "type": "integer"
                },
                "body_hash": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "status"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "prev_receipt_hash": {
          "type": [
            "string",
            "null"
          ]
        },
        "receipt_hash": {
          "type": "string"
        }
      },
      "required": [
        "v",
        "agent",
        "nonce",
        "ts",
        "policy_v",
        "request",
        "decision",
        "reason",
        "price",
        "facilitator",
        "tx_sig",
        "response",
        "prev_receipt_hash",
        "receipt_hash"
      ],
      "additionalProperties": false
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#"
}