title: Order Line Item
type: object
x-tags:
  - Models
description: An immutable line item in a captured purchase.
required:
  - source_reference
  - product_reference
  - paid_quantity
  - name
  - quantity
  - total_amount
  - modifiers
  - metadata
properties:
  source_reference:
    type:
      - string
      - 'null'
    minLength: 1
    maxLength: 255
    pattern: '^[\x21-\x7E]+$'
    description: The integration's stable reference for this line item. Required and non-null when product_reference or paid_quantity is non-null, including a paid quantity of zero.
  product_reference:
    type: [string, 'null']
    minLength: 1
    maxLength: 255
    pattern: '^[\x21-\x7E]+$'
    description: Stable case-sensitive source product identity, independent of the line reference. Use null for POS custom items without a catalog identity. Such lines are ignored for product-quantity stamp, point and cashback earning; other earning modes and tier spend still apply. Null references are retained in stored purchase facts and replay checksums. No product catalogue lookup is performed.
  paid_quantity:
    type: [string, 'null']
    pattern: '^\d{1,14}\.\d{6}$'
    description: Sold units receiving nonzero payment after discounts, before refunds. Cannot exceed quantity; null means not supplied. Required for a non-null product_reference when product-quantity earning applies; may be null for custom items with no product reference. A stable line source_reference is required when paid_quantity is non-null, including zero.
  name:
    type: string
    minLength: 1
    maxLength: 255
    description: The name displayed for this line item.
  quantity:
    type: string
    pattern: '^(?=.*[1-9])(?:\d{1,14})(?:\.\d{6})$'
    example: '1.000000'
    description: The positive quantity, normalized to six decimal places.
  total_amount:
    allOf:
      - $ref: ./Money.yaml
      - type: object
        properties:
          amount:
            minimum: 0
            maximum: 4294967295
    description: The current total for the line item, including any modifier value represented by the source system.
  modifiers:
    type: array
    minItems: 0
    description: Optional additions or choices associated with this line item.
    items:
      type: object
      required:
        - source_reference
        - name
        - quantity
        - total_amount
        - metadata
      properties:
        source_reference:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 255
          pattern: '^[\x21-\x7E]+$'
          description: The integration's reference for this modifier, if available.
        name:
          type: string
          minLength: 1
          maxLength: 255
          description: The name displayed for this modifier.
        quantity:
          type: string
          pattern: '^(?=.*[1-9])(?:\d{1,14})(?:\.\d{6})$'
          example: '1.000000'
          description: The positive quantity, normalized to six decimal places.
        total_amount:
          allOf:
            - $ref: ./Money.yaml
            - type: object
              properties:
                amount:
                  minimum: 0
                  maximum: 4294967295
          description: The current modifier total.
        metadata:
          oneOf:
            - type: object
              additionalProperties: true
            - type: array
              items: {}
          description: Integration-specific modifier context.
  metadata:
    oneOf:
      - type: 'null'
      - type: object
        additionalProperties: true
      - type: array
        items: {}
    description: Integration-specific line-item context.
