{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.fideliyapass.com/schemas/webhooks/2026-11/gift_card.spent.json",
  "type": "object",
  "properties": {
    "gift_card_id": {
      "type": "string",
      "minLength": 1
    },
    "transaction_id": {
      "type": "string",
      "minLength": 1,
      "description": "The payment: the row in the card's ledger (GET /v1/gift_cards/{id}, `transactions`)."
    },
    "amount": {
      "type": "number",
      "description": "What was taken, in the card's currency (sessions for a SESSIONS card)."
    },
    "balance": {
      "type": "number",
      "description": "What is left on the card after it."
    },
    "currency": {
      "type": "string",
      "description": "EUR, MAD, AED, QAR, or SESSIONS."
    },
    "status": {
      "type": "string",
      "description": "`active`, or `depleted` when this payment used the card up."
    },
    "location_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The counter it was taken at, when known."
    },
    "reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The till's own reference for the payment, when the API call gave one."
    },
    "source": {
      "type": "string",
      "enum": [
        "scanner",
        "api"
      ],
      "description": "Taken at the counter with the scanner, or by your system through an API key."
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
    }
  },
  "required": [
    "gift_card_id",
    "transaction_id",
    "amount",
    "balance",
    "currency",
    "status",
    "location_id",
    "reference",
    "source",
    "timestamp"
  ],
  "description": "A payment was taken from a gift card, at the counter or through the API. Undone within seconds at the till, it is followed by scan.voided (kind gift_card_spend).",
  "examples": [
    {
      "gift_card_id": "d4e5f6a7-b8c9-4d0e-8f1a-2b3c4d5e6f7a",
      "transaction_id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "amount": 12.5,
      "balance": 12.5,
      "currency": "EUR",
      "status": "active",
      "location_id": null,
      "reference": "T-1042",
      "source": "api",
      "timestamp": "2026-11-03T10:15:00.000Z"
    }
  ]
}
