title: Discount Request
x-tags:
  - Catalog
type: object
description: On edit, omitted top-level properties retain their existing values.
properties:
  name:
    type: string
    minLength: 1
    maxLength: 255
  tags:
    allOf:
      - $ref: ./CatalogUuidList.yaml
    description: UUIDs of tags to associate with the discount.
  calculation:
    type: object
    description: Defines a fixed, percentage, or price-override catalog calculation.
    required:
      - type
    properties:
      type:
        type: string
        enum:
          - fixed
          - percentage
          - price_override
      fixed_value:
        allOf:
          - $ref: ./Money.yaml
          - type: object
            properties:
              amount:
                minimum: 1
                maximum: 4294967295
                description: The amount in the currency's lowest denomination. Zero is not permitted.
              currency:
                description: Must match the merchant's ISO 4217 currency code.
      percentage:
        type: string
        pattern: '^((0\.[1-9])|([1-9]([0-9])?(\.[0-9])?)|100)$'
        description: A percentage between 0.1 and 100 inclusive, with at most one decimal place.
      percentage_cap:
        default: null
        oneOf:
          - type: 'null'
          - allOf:
              - $ref: ./Money.yaml
              - type: object
                properties:
                  amount:
                    minimum: 1
                    maximum: 4294967295
                    description: The amount in the currency's lowest denomination. Zero is not permitted.
                  currency:
                    description: Must match the merchant's ISO 4217 currency code.
      price_override:
        allOf:
          - $ref: ./Money.yaml
          - type: object
            properties:
              amount:
                minimum: 1
                maximum: 4294967295
                description: The amount in the currency's lowest denomination. Zero is not permitted.
              currency:
                description: Must match the merchant's ISO 4217 currency code.
    oneOf:
      - properties:
          type:
            const: fixed
        required:
          - fixed_value
      - properties:
          type:
            const: percentage
        required:
          - percentage
      - properties:
          type:
            const: price_override
        required:
          - price_override
  product_group:
    type:
      - string
      - 'null'
    format: uuid
    description: |-
      The UUID of a product group owned by the merchant.

      Required for price-override and quantity-based discounts.

      On edit, omit this property to retain the existing product group or supply `null` to remove it.
  availability:
    $ref: ./AvailabilityRequest.yaml
  description:
    type:
      - string
      - 'null'
    minLength: 1
    maxLength: 255
    description: On edit, omit this property to retain the existing description or supply `null` to remove it.
  total_redemption_limit:
    type:
      - integer
      - 'null'
    minimum: 1
    description: On edit, omit this property to retain the existing limit or supply `null` to remove it.
  daily_redemption_limit:
    type:
      - integer
      - 'null'
    minimum: 1
    description: On edit, omit this property to retain the existing limit or supply `null` to remove it.
  total_user_redemption_limit:
    type:
      - integer
      - 'null'
    minimum: 1
    description: On edit, omit this property to retain the existing limit or supply `null` to remove it.
  daily_user_redemption_limit:
    type:
      - integer
      - 'null'
    minimum: 1
    description: On edit, omit this property to retain the existing limit or supply `null` to remove it.
  allow_redemption_alongside_others:
    type: boolean
    description: May only be false when the discount has a promo code.
  auto_apply:
    type: boolean
    description: Must be true when the discount has a promo code.
  minimum_sub_total_spend:
    description: On edit, omit this property to retain the existing minimum spend or supply `null` to remove it.
    oneOf:
      - type: 'null'
      - allOf:
          - $ref: ./Money.yaml
          - type: object
            properties:
              amount:
                minimum: 1
                maximum: 4294967295
                description: The amount in the currency's lowest denomination. Zero is not permitted.
              currency:
                description: Must match the merchant's ISO 4217 currency code.
  qty_allocation_mechanics:
    description: On edit, omit this property to retain the existing quantity mechanics or supply `null` to remove them.
    oneOf:
      - type: 'null'
      - type: object
        description: The mechanics that control a quantity-based discount.
        required:
          - trigger_product_group
          - trigger_qty
          - discount_qty
        properties:
          trigger_product_group:
            type: string
            format: uuid
            description: The UUID of a product group owned by the merchant that triggers the discount.
          trigger_qty:
            type: integer
            minimum: 1
          discount_qty:
            type: integer
            minimum: 1
          allocation_limit:
            type:
              - integer
              - 'null'
            minimum: 1
            default: null
