title: Order
type: object
x-tags:
  - Orders
description: Represents an order that was placed at an outlet.
properties:
  uuid:
    type: string
    format: uuid
    description: The unique identifier.
  staff_member:
    description: The staff member currently associated with the order, if any.
    oneOf:
      - type: 'null'
      - $ref: ./OrderStaffMember.yaml
  revision:
    type: integer
    minimum: 1
    description: The current revision/version of the order.
  status:
    $ref: ./OrderStatus.yaml
    description: The current status of the order.
  number:
    type: string
    example: YQ-22
    description: The formatted order number.
    minLength: 1
    maxLength: 255
  service_type:
    $ref: ./ServiceType.yaml
    description: The service type associated with the order.
  customer:
    oneOf:
      - type: 'null'
      - type: object
        $ref: ./CustomerDetails.yaml
    description: 'The details of the customer that placed the order, if known.'
  dispatched_at:
    type: string
    format: date-time
    description: The date-time that the order was dispatched to the outlet.
  closed_off_at:
    type:
      - string
      - 'null'
    format: date-time
    description: The date-time that the order was (last) closed off.
  cancelled_at:
    type:
      - string
      - 'null'
    format: date-time
    description: The date-time that the order was last cancelled or merged into another order. Use status to distinguish genuine cancellations from merged sources.
  merchant_cancellation_reason:
    type:
      - string
      - 'null'
    description: |-
      The human-readable reason why the merchant cancelled the order.

      If this field is non-null, then `cancelled_at` will also be non-null.
  kitchen_attributes:
    oneOf:
      - type: 'null'
      - $ref: ./KitchenAttributes.yaml
  collection_attributes:
    oneOf:
      - type: 'null'
      - $ref: ./CollectionAttributes.yaml
  delivery_address:
    oneOf:
      - type: 'null'
      - type: object
        $ref: ./Address.yaml
    description: The delivery address associated with the order (if any).
  cancel_order_on_unavailability:
    type: boolean
    description: Indicates if the customer would prefer the order to be completely cancelled if one or more items are unavailable.
  client:
    type:
      - string
      - 'null'
    format: uuid
    description: 'The UUID of the client application that placed this order, if known.'
  merchant_notes:
    type:
      - string
      - 'null'
    minLength: 1
    maxLength: 255
    description: Any notes that the merchant has attached to the order.
  customer_notes:
    type:
      - string
      - 'null'
    minLength: 1
    maxLength: 255
    description: Any notes that the customer has attached to the order.
  customer_question_answers:
    type: array
    description: |-
      Saved customer question answers. An empty array is returned when no answers have been collected.
    items:
      $ref: ./CustomerQuestionAnswer.yaml
  customer_receipt_notes:
    type:
      - string
      - 'null'
    description: Any receipt notes that have been attached to the order.
    minLength: 1
    maxLength: 255
  line_items:
    type: array
    items:
      $ref: ./OrderLineItem.yaml
  sub_total:
    $ref: ./Money.yaml
    description: The aggregate value of the sub-total of each line item.
  discounts:
    type: array
    description: The discounts applied to the order.
    uniqueItems: true
    items:
      $ref: ./Aggregate.yaml
  total_discounts:
    $ref: ./Money.yaml
    description: The aggregate value of the discounts applied to each line item.
  surcharges:
    type: array
    uniqueItems: true
    description: The surcharges levied against the order.
    items:
      $ref: ./Aggregate.yaml
  total_surcharges:
    $ref: ./Money.yaml
    description: The aggregate value of the surcharges levied against each line item.
  taxes:
    type: array
    uniqueItems: true
    description: The taxes levied against the order.
    items:
      $ref: ./Aggregate.yaml
  total_taxes:
    $ref: ./Money.yaml
    description: The aggregate value of the taxes levied against each line item.
  total:
    $ref: ./Money.yaml
    description: The aggregate value of the total of each line item.
  amount_paid:
    $ref: ./Money.yaml
    description: The total non-refunded and successful amount paid against the order.
  cash_rounding:
    $ref: ./Money.yaml
    description: The value of any cash-rounding applied to the order.
  balance:
    $ref: ./Money.yaml
    description: The balance (outstanding amount) of the order.
  transactions:
    type: array
    description: The transactions that have been processed against the order.
    items:
      $ref: ./OrderTransaction.yaml
  events:
    type: array
    description: The events that have occured against the order.
    items:
      $ref: ./OrderEvent.yaml
  merged_from_order_uuids:
    type:
      - array
      - 'null'
    uniqueItems: true
    description: UUIDs of source orders merged into this order. Null when no merge sources are recorded.
    items:
      type: string
      format: uuid
  merged_into_order_uuid:
    type:
      - string
      - 'null'
    format: uuid
    description: The UUID of the direct target this source was merged into, or null. The target may not have synced yet.
