title: Order
type: object
x-tags:
  - Models
description: An immutable captured purchase and its current capture/void status. Every monetary field, line-item total and modifier total uses `currency_code`.
required:
  - uuid
  - source_reference
  - display_reference
  - source_url
  - status
  - outlet
  - customer
  - currency_code
  - line_items
  - total_amount
  - qualifying_amount
  - eligible_amount
  - quantity_evaluations
  - completed_at
  - cancelled_at
  - metadata
  - created_at
  - updated_at
  - cashback_evaluations
properties:
  uuid:
    type: string
    format: uuid
    readOnly: true
    description: The platform's unique identifier for the captured purchase.
  source_reference:
    type: string
    minLength: 1
    maxLength: 255
    pattern: '^[\x21-\x7E]+$'
    description: The case-sensitive integration reference that uniquely identifies this order within the merchant.
  display_reference:
    type:
      - string
      - 'null'
    maxLength: 255
    example: YQ-5
    description: The optional human-facing order reference shown to merchant staff. This does not identify the order or replace `source_reference`.
  source_url:
    type:
      - string
      - 'null'
    format: uri
    pattern: '^https://'
    maxLength: 2048
    example: 'https://merchant.yqueue.app/orders/order-1000'
    description: The optional HTTPS URL at which merchant staff can view the order in the source platform.
  status:
    $ref: ./OrderStatus.yaml
  outlet:
    $ref: ./OutletReference.yaml
    description: The associated outlet, with its current name.
  customer:
    oneOf:
      - type: 'null'
      - $ref: ./CustomerReference.yaml
    description: The associated customer, or `null` if the customer has since been deleted. The name reflects the current customer profile.
  currency_code:
    type: string
    minLength: 3
    maxLength: 3
    description: The merchant's ISO 4217 alpha-3 currency code.
  line_items:
    type: array
    minItems: 1
    maxItems: 65535
    items:
      $ref: ./OrderLineItem.yaml
  total_amount:
    allOf:
      - $ref: ./Money.yaml
      - type: object
        properties:
          amount:
            minimum: 0
            maximum: 4294967295
    description: The original captured purchase total, retained after full void.
  qualifying_amount:
    allOf:
      - $ref: ./Money.yaml
      - type: object
        properties:
          amount:
            minimum: 0
            maximum: 4294967295
    description: The original captured qualifying amount. A full void removes its contribution while retaining this value.
  eligible_amount:
    oneOf:
      - type: 'null'
      - allOf:
          - $ref: ./Money.yaml
          - type: object
            properties:
              amount:
                minimum: 0
                maximum: 4294967295
    description: Discounted eligible sale value before refunds, excluding taxes, service charges, tips and
      top-ups. Payment using stored value qualifies. Cannot exceed total_amount; null means not supplied.
      Independent of qualifying_amount. Cashback-funded spend is excluded by the producer; no funding breakdown is
      inferred.
  quantity_evaluations:
    type: array
    description: Frozen per-program evaluations, including zero awards. Empty when no quantity program applied. Use source_order_uuid on operation or ledger searches to retrieve actual base and bonus movements. Tier gift outcomes remain on customer tier achievements.
    items:
      $ref: ./OrderQuantityEvaluation.yaml
  cashback_evaluations:
    type: array
    items:
      $ref: ./OrderCashbackEvaluation.yaml
    description: Frozen cashback evaluations, including zero awards. Empty when no cashback program applied;
      source_order_uuid history filters expose actual earning/bonus/void/expiry movements.
  completed_at:
    type: string
    format: date-time
    pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$'
    description: The captured purchase completion timestamp in UTC, retained after full void.
  cancelled_at:
    type:
      - string
      - 'null'
    format: date-time
    pattern: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$'
    description: The UTC processing time of the terminal full void, or null while captured.
  metadata:
    oneOf:
      - type: 'null'
      - type: object
        additionalProperties: true
      - type: array
        items: {}
    description: Integration-specific context retained with the immutable capture.
  created_at:
    type: string
    format: date-time
    readOnly: true
    description: The UTC date-time at which the order was first submitted.
  updated_at:
    type: string
    format: date-time
    readOnly: true
    description: The UTC date-time at which the capture or its void was recorded.
