title: Quantity Configuration
x-tags:
  - Models
description: Saved unit earning terms, purchase bonuses, voucher exchange options and direct-discount options. All
  fields are returned. Products are non-empty for product-quantity earning and null otherwise; reward and bonus lists
  are always arrays. Configuration edits do not recalculate past purchases or rewrite redemption receipts.
oneOf:
  - title: Product quantity
    type: object
    required:
      - earning_mode
      - products
      - minimum_eligible_spend
      - spend_interval
      - validity_period_in_days
      - exchange_options
      - earning_bonuses
      - redemption_options
    properties:
      earning_mode:
        type: string
        enum:
          - product_quantity
      products:
        type: array
        minItems: 1
        items:
          $ref: ./LoyaltyProduct.yaml
      minimum_eligible_spend:
        type: "null"
      spend_interval:
        type: "null"
      validity_period_in_days: &a2
        type:
          - integer
          - "null"
        minimum: 1
        maximum: 3650
        description: Validity for unit credits from processing time, including earning, manual additions and tier gifts.
          A credit never shortens an existing positive pool's validity. Keep the later of the current expiry and the new
          expiry; an existing no-expiry pool remains unlimited. Null or omitted validity removes a finite expiry. Empty
          or expired pools use the configured validity for the new credit. Purchase base and bonus units renew together.
      earning_bonuses: &quantityEarningBonuses
        type: array
        maxItems: 50
        description: Optional purchase bonuses, using whole-order eligible spend after discounts. Product-mode programs with any
          spend bonuses also require eligible_amount on applicable captures. The greatest qualifying bonus allowed for
          the resulting tier is added once only after a positive base unit award. An empty list disables purchase
          bonuses.
        items:
          $ref: ./QuantityEarningBonus.yaml
      exchange_options: &a3
        type: array
        description: Zero or more voucher rewards. An empty list is permitted. Supplying configuration replaces this complete
          list; retain each existing option UUID to preserve its identity. New options may omit UUID and receive a
          generated identity. Destination availability and lifetime issuance limits are enforced when exchanging,
          independently of configuration validity.
        items:
          type: object
          required:
            - uuid
            - quantity_cost
            - voucher_program_uuid
          properties:
            uuid:
              type: string
              format: uuid
              description: Stable option identity retained across edits when supplied.
            quantity_cost:
              type: integer
              minimum: 1
              maximum: 2147483647
            voucher_program_uuid:
              type: string
              format: uuid
              description: Existing voucher program belonging to the same merchant and using the same currency. Archived or currently
                unavailable destinations may be configured.
      redemption_options:
        type: array
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOption.yaml
  - title: Order
    type: object
    required:
      - earning_mode
      - products
      - minimum_eligible_spend
      - spend_interval
      - validity_period_in_days
      - exchange_options
      - earning_bonuses
      - redemption_options
    properties:
      earning_mode:
        type: string
        enum:
          - order
      products:
        type: "null"
        description: Not applicable to this earning mode.
      minimum_eligible_spend:
        oneOf:
          - type: "null"
          - $ref: ./PositiveMoney.yaml
        description: Optional positive minimum eligible spend for one unit per qualifying completed order. Null means no
          monetary minimum.
      spend_interval:
        type: "null"
      validity_period_in_days: *a2
      earning_bonuses: *quantityEarningBonuses
      exchange_options: *a3
      redemption_options:
        type: array
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOption.yaml
  - title: Spend interval
    type: object
    required:
      - earning_mode
      - products
      - minimum_eligible_spend
      - spend_interval
      - validity_period_in_days
      - exchange_options
      - earning_bonuses
      - redemption_options
    properties:
      earning_mode:
        type: string
        enum:
          - spend_interval
      products:
        type: "null"
        description: Not applicable to this earning mode.
      minimum_eligible_spend:
        type: "null"
      spend_interval:
        $ref: ./PositiveMoney.yaml
        description: Positive eligible monetary spend required for each unit. No remainder carries between orders.
      validity_period_in_days: *a2
      earning_bonuses: *quantityEarningBonuses
      exchange_options: *a3
      redemption_options:
        type: array
        description: Direct order discounts sharing the unit pool with voucher exchanges. Retain option UUIDs through edits.
          Pool expiry supplies validity; there are no separate option dates or issuance limits. An empty list disables
          direct redemption without removing exchanges.
        items:
          $ref: ./QuantityRedemptionOption.yaml
