> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voucherify.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Disable Earning Rule

> Disable an earning rule.



## OpenAPI

````yaml /openapi/loyalties.json post /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable
openapi: 3.0.1
info:
  title: Voucherify API - Loyalties
  version: v2018-08-01
  description: >-
    Voucherify promotion engine REST API. Please see
    https://docs.voucherify.io/docs for more details.
  contact:
    name: Voucherify Team
    url: https://www.voucherify.io/contact-support
    email: support@voucherify.io
  termsOfService: https://www.voucherify.io/legal/subscription-agreement
  license:
    name: MIT
    url: https://github.com/voucherifyio/voucherify-js-sdk/blob/main/LICENSE
servers:
  - url: https://{cluster}.voucherify.io
    description: Base URL
    variables:
      cluster:
        default: api
        enum:
          - api
          - us1.api
          - as1.api
          - download
          - us1.download
          - as1.download
security: []
paths:
  /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterCampaignId'
        name: campaignId
        in: path
        required: true
        description: Unique campaign ID or name.
      - schema:
          $ref: '#/components/schemas/ParameterEarningRuleId'
        name: earningRuleId
        in: path
        required: true
        description: Unique identifier of an earning rule, assigned by Voucherify.
    post:
      tags:
        - Loyalties
      summary: Disable Earning Rule
      description: Disable an earning rule.
      operationId: disable-earning-rule
      parameters: []
      responses:
        '200':
          description: >-
            Returns an earning rule object with the `active` parameter set to
            `false`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoyaltiesEarningRulesDisableResponseBody'
              examples:
                Example:
                  value:
                    id: ern_A2RArBE30Tkt56utVLrRv7rZ
                    created_at: '2022-11-25T07:31:05.866Z'
                    updated_at: '2022-11-25T14:12:57.167Z'
                    loyalty:
                      points: 1
                      type: FIXED
                    event: customer.loyalty.tier.downgraded
                    loyalty_tier:
                      id: __ANY__
                    source:
                      banner: Tier Downgraded
                      object_id: camp_fkZ28pe7DUAEmmabofkxHI8N
                      object_type: campaign
                    active: false
                    object: earning_rule
                    automation_id: auto_TMVZtCNMBgZm0KcPJ7otiHZW
                    metadata:
                      Type: Tier
        '404':
          description: Returns an error if the resource cannot be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                Not Found:
                  value:
                    code: 404
                    key: not_found
                    message: Resource not found
                    details: >-
                      Cannot find earning_rule with id
                      ern_A2RArBE30Tkt56utVLrRv7r
                    request_id: v-0c0d842ed5ce67373f
                    resource_id: ern_A2RArBE30Tkt56utVLrRv7r
                    resource_type: earning_rule
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - loyalties
components:
  schemas:
    ParameterCampaignId:
      type: string
      example: camp_rRsfatlwN7unSeUIJDCYedal
    ParameterEarningRuleId:
      type: string
      example: ern_CFuv1O0IDl8Jgph0ojhMu8bH
    LoyaltiesEarningRulesDisableResponseBody:
      title: Loyalties Earning Rules Disable Response Body
      description: >-
        Response body schema for **POST**
        `v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable`
      allOf:
        - $ref: '#/components/schemas/EarningRuleBase'
        - type: object
          properties:
            updated_at:
              type: string
              nullable: true
              format: date-time
              description: >-
                Timestamp representing the date and time when the earning rule
                was last updated in ISO 8601 format.
            active:
              type: boolean
              default: false
              description: >-
                A flag to toggle the earning rule on or off. You can disable an
                earning rule even though it's within the active period defined
                by the start_date and expiration_date of the campaign or the
                earning rule's own start_date and expiration_date.
          required:
            - updated_at
            - active
    Error:
      title: Error Object
      type: object
      description: Error details
      properties:
        code:
          type: integer
          description: Error's HTTP status code.
        key:
          type: string
          description: Short string describing the kind of error which occurred.
        message:
          type: string
          description: A human-readable message providing a short description of the error.
        details:
          type: string
          description: A human-readable message providing more details about the error.
        request_id:
          type: string
          example: v-0a885062c80375740f
          description: >-
            This ID is useful when troubleshooting and/or finding the root cause
            of an error response by our support team.
        resource_id:
          type: string
          description: >-
            Unique resource ID that can be used in another endpoint to get more
            details.
          example: rf_0c5d710a87c8a31f86
        resource_type:
          type: string
          description: The resource type.
          example: voucher
        error:
          type: object
          description: Includes additional information about the error.
          properties:
            message:
              type: string
              description: The message configured by the user in a validation rule.
      required:
        - code
        - message
    EarningRuleBase:
      title: EarningRuleBase
      type: object
      properties:
        id:
          type: string
          description: Assigned by the Voucherify API, identifies the earning rule object.
        created_at:
          type: string
          format: date-time
          description: >-
            Timestamp representing the date and time when the earning rule was
            created. The value is shown in the ISO 8601 format.
        loyalty:
          oneOf:
            - $ref: '#/components/schemas/EarningRuleFixed'
            - $ref: '#/components/schemas/EarningRuleProportional'
        event:
          description: >-
            Defines the event which triggers the earning rule to add points to a
            loyalty card.
          allOf:
            - $ref: '#/components/schemas/EarningRuleEvent'
        custom_event:
          description: Contains details about the custom event.
          type: object
          properties:
            schema_id:
              description: Unique identifier of the custom event schema
              type: string
          required:
            - schema_id
        segment:
          type: object
          description: >-
            Contains the ID of a customer segment. Required for the
            `customer.segment.entered` option in the event.
          properties:
            id:
              type: string
              description: >-
                Contains a unique identifier of a customer segment. Assigned by
                the Voucherify API.
          required:
            - id
        loyalty_tier:
          type: object
          description: Defines the tier associated with the earning rule definition.
          properties:
            id:
              type: string
              description: |-
                Unique loyalty tier ID associated with the earning rule.    

                - `__ANY__`: any loyalty tier within the campaign
              example: ltr_pudTGWasuIqxdiDM0go31OV1
        pending_points:
          type: object
          description: >-
            Defines the configuration for pending points. Pending points can be
            used only with the `order.paid` event.
          properties:
            period_type:
              type: string
              description: >-
                Defines the type of the period during which the points are in
                the pending state. Currently, only `DAY` value is accepted.
              enum:
                - DAY
            period_value:
              type: integer
              description: >-
                Defines for how long the points are in the pending state. The
                minimum value is 1, maximum is 90.
              minimum: 1
              maximum: 90
        source:
          type: object
          required:
            - object_id
            - object_type
          description: Contains the custom earning rule name and parent campaign.
          properties:
            banner:
              type: string
              description: >-
                Name of the earning rule. This is displayed as a header for the
                earning rule in the Dashboard.
            object_id:
              type: string
              description: A unique campaign identifier assigned by the Voucherify API.
            object_type:
              type: string
              description: >-
                Defines the object associated with the earning rule. Defaults to
                `campaign`.
              default: campaign
              enum:
                - campaign
        object:
          type: string
          default: earning_rule
          enum:
            - earning_rule
          description: The type of the object represented by JSON. Default is earning_rule.
        automation_id:
          type: string
          description: For internal use by Voucherify.
        start_date:
          type: string
          description: >-
            Start date defines when the earning rule starts to be active.
            Activation timestamp is presented in the ISO 8601 format. The
            earning rule is inactive before this date. If you do not define the
            start date for an earning rule, it will inherit the campaign start
            date by default.
        expiration_date:
          type: string
          description: >-
            Expiration date defines when the earning rule expires. Expiration
            timestamp is presented in the ISO 8601 format. The earning rule is
            inactive after this date. If you do not define the expiration date
            for an earning rule, it will inherit the campaign expiration date by
            default.
        validity_timeframe:
          $ref: '#/components/schemas/ValidityTimeframe'
        validity_day_of_week:
          $ref: '#/components/schemas/ValidityDayOfWeek'
        validity_hours:
          $ref: '#/components/schemas/ValidityHours'
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            earning rule. A set of key/value pairs that you can attach to an
            earning rule object. It can be useful for storing additional
            information about the earning rule in a structured format.
        expiration_rules:
          $ref: '#/components/schemas/EarningRuleExpirationRules'
      required:
        - id
        - created_at
        - loyalty
        - source
        - object
        - automation_id
        - metadata
    EarningRuleFixed:
      title: Define fixed amount of points
      type: object
      properties:
        type:
          type: string
          default: FIXED
          enum:
            - FIXED
          description: The number of points to be added to the loyalty card.
        points:
          type: integer
          description: >-
            Defines how the points will be added to the loyalty card. FIXED adds
            a fixed number of points.
        points_formula:
          type: string
          description: Formula used to dynamically calculate the rewarded points.
      required:
        - type
        - points
    EarningRuleProportional:
      title: Calculate points proportionally
      oneOf:
        - $ref: '#/components/schemas/EarningRuleProportionalOrder'
        - $ref: '#/components/schemas/EarningRuleProportionalOrderItems'
        - $ref: '#/components/schemas/EarningRuleProportionalCustomerMetadata'
        - $ref: '#/components/schemas/EarningRuleProportionalCustomEvent'
    EarningRuleEvent:
      title: Earning Rule Event
      example: >-
        `order.paid`, `customer.segment.entered`,
        `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`,
        `customer.loyalty.tier.prolonged`, `customer.loyalty.tier.joined`,
        `customer.loyalty.tier.left`
      type: string
    ValidityTimeframe:
      title: Validity Timeframe
      type: object
      description: >-
        Set recurrent time periods when the earning rule is valid. For example,
        valid for 1 hour every other day.`start_date` **required** when
        including the `validity_timeframe`.
      properties:
        duration:
          type: string
          description: >-
            Defines the amount of time an earning rule will be active in ISO
            8601 format. For example, an earning rule with a `duration` of
            `PT1H` will be valid for a duration of one hour.
          example: PT1H
        interval:
          type: string
          description: >-
            Defines the intervening time between two time points in ISO 8601
            format, expressed as a duration. For example, an earning rule with
            an `interval` of `P2D` will be valid every other day.
          example: P2D
    ValidityDayOfWeek:
      title: Validity Day Of Week
      type: array
      description: >-
        Integer array corresponding to the particular days of the week in which
        the voucher is valid.


        - `0` Sunday

        - `1` Monday

        - `2` Tuesday

        - `3` Wednesday

        - `4` Thursday

        - `5` Friday

        - `6` Saturday
      items:
        type: integer
        enum:
          - 0
          - 1
          - 2
          - 3
          - 4
          - 5
          - 6
    ValidityHours:
      title: Validity Hours
      type: object
      description: Determines the hours of validity, e.g. to create a happy hours scenario.
      properties:
        daily:
          type: array
          description: >-
            Defines the recurring period(s) when the resource is active. The
            periods should not overlap.
          items:
            type: object
            description: Defines the recurring period(s) when the resource will be active.
            properties:
              start_time:
                type: string
                format: time
                description: >-
                  Defines the starting hour of validity in the HH:mm format. The
                  resource is *inactive before* this time.
                example: '12:00'
              days_of_week:
                type: array
                description: >-
                  Integer array corresponding to the particular days of the week
                  in which the resource is valid.


                  - `0` Sunday

                  - `1` Monday

                  - `2` Tuesday

                  - `3`  Wednesday

                  - `4` Thursday

                  - `5` Friday

                  - `6` Saturday
                items:
                  type: integer
                  enum:
                    - 0
                    - 1
                    - 2
                    - 3
                    - 4
                    - 5
                    - 6
              expiration_time:
                type: string
                format: time
                description: >-
                  Defines the ending hour of validity in the HH:mm format. The
                  resource is *inactive after* this time.
                example: '14:00'
    EarningRuleExpirationRules:
      title: Earning Rule Expiration Rules
      type: object
      description: >-
        Defines the loyalty point expiration rule. This expiration rule applies
        only to this earning rule and supersedes `expiration_rules` defined in
        the `voucher.loyalty_card` object.
      properties:
        period_type:
          type: string
          description: >-
            Type of period. Can be set for `MONTH` or `FIXED_DAY_OF_YEAR`.
            `MONTH` requires the `period_value` field. `FIXED_DAY_OF_YEAR`
            requires the `fixed_month` and `fixed_day` fields.
          enum:
            - FIXED_DAY_OF_YEAR
            - MONTH
        period_value:
          type: integer
          description: 'Value of the period. Required for the `period_type: MONTH`.'
        rounding_type:
          type: string
          description: >-
            Type of rounding of the expiration period. Optional for the
            `period_type: MONTH`.
          enum:
            - END_OF_MONTH
            - END_OF_QUARTER
            - END_OF_HALF_YEAR
            - END_OF_YEAR
            - PARTICULAR_MONTH
        rounding_value:
          type: integer
          description: >-
            Value of rounding of the expiration period. Required for the
            `rounding_type`.
        fixed_month:
          type: integer
          description: >-
            Determines the month when the points expire; `1` is January, `2` is
            February, and so on. Required for the `period_type:
            FIXED_DAY_OF_YEAR`.
          minimum: 1
          maximum: 12
        fixed_day:
          type: integer
          description: >-
            Determines the day of the month when the points expire. Required for
            the `period_type: FIXED_DAY_OF_YEAR`.
          minimum: 1
          maximum: 31
      required:
        - period_type
    EarningRuleProportionalOrder:
      title: Define amount of points proportional to the order
      oneOf:
        - $ref: '#/components/schemas/EarningRuleProportionalOrderAmount'
        - $ref: '#/components/schemas/EarningRuleProportionalOrderTotalAmount'
        - $ref: '#/components/schemas/EarningRuleProportionalOrderMetadata'
    EarningRuleProportionalOrderItems:
      title: Define amount of points proportional to order items
      oneOf:
        - $ref: '#/components/schemas/EarningRuleProportionalOrderItemsQuantity'
        - $ref: '#/components/schemas/EarningRuleProportionalOrderItemsAmount'
        - $ref: '#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount'
    EarningRuleProportionalCustomerMetadata:
      title: Define amount of points proportional to customer metadata
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: CUSTOMER_METADATA
          enum:
            - CUSTOMER_METADATA
          description: >-
            CUSTOMER_METADATA: Customer Metadata (X points for every Y in
            metadata attribute, defined in the property key under the
            customer.metadata object)
        customer:
          type: object
          required:
            - metadata
          properties:
            metadata:
              type: object
              required:
                - every
                - points
                - property
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every given increment of value
                (1, 10, etc) defined in the every parameter for the property
                defined in calculation_type, give the customer the number of
                points defined in the points parameter. In other words, for
                every order metadata property value, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    For how many increments of the customer metadata property to
                    grant points for.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                property:
                  type: string
                  description: Customer metadata property.
      required:
        - type
        - calculation_type
        - customer
    EarningRuleProportionalCustomEvent:
      title: Earning Rule Proportional Custom Event
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: CUSTOM_EVENT_METADATA
          enum:
            - CUSTOM_EVENT_METADATA
          description: >-
            CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y
            in metadata attribute).
        custom_event:
          type: object
          required:
            - metadata
          properties:
            metadata:
              type: object
              required:
                - every
                - points
                - property
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every given increment of value
                (1, 10, etc) defined in the every parameter for the property
                defined in calculation_type, give the customer the number of
                points defined in the points parameter. In other words, for
                every order metadata property value, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    For how many increments of the customer metadata property to
                    grant points for.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                property:
                  type: string
                  description: |-

                    Custom event metadata property.
      required:
        - type
        - calculation_type
        - custom_event
    EarningRuleProportionalOrderAmount:
      title: Order Amount
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_AMOUNT
          enum:
            - ORDER_AMOUNT
          description: >-
            `ORDER_AMOUNT`: Pre-discount order amount (X points for every Y
            spent excluding discounts)
        order:
          type: object
          required:
            - amount
          properties:
            amount:
              type: object
              required:
                - every
                - points
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every set of value (1, 10, etc)
                defined in the every parameter for the property defined in
                calculation_type, give the customer the number of points defined
                in the points parameter. In other words, for every
                calculation_type, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    Value is multiplied by 100 to precisely represent 2 decimal
                    places. For example, a $10 order amount is written as 1000.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
      required:
        - type
        - calculation_type
        - order
    EarningRuleProportionalOrderTotalAmount:
      title: Order Total Amount
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_TOTAL_AMOUNT
          enum:
            - ORDER_TOTAL_AMOUNT
          description: >-
            `ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent
            including discount)
        order:
          type: object
          required:
            - total_amount
          properties:
            total_amount:
              type: object
              required:
                - every
                - points
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every set of value (1, 10, etc)
                defined in the every parameter for the property defined in
                calculation_type, give the customer the number of points defined
                in the points parameter. In other words, for every
                calculation_type, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    Value is multiplied by 100 to precisely represent 2 decimal
                    places. For example, a $10 order amount is written as 1000.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
      required:
        - type
        - calculation_type
        - order
    EarningRuleProportionalOrderMetadata:
      title: Order Metadata
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_METADATA
          enum:
            - ORDER_METADATA
          description: >-
            `ORDER_METADATA`: Order Metadata (X points for every Y in metadata
            attribute, defined in the property key under the order.metadata
            object)
        order:
          type: object
          required:
            - metadata
          description: Defines the formula for calculating points proportionally.
          properties:
            metadata:
              type: object
              required:
                - every
                - points
                - property
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every given increment of value
                (1, 10, etc) defined in the every parameter for the property
                defined in calculation_type, give the customer the number of
                points defined in the points parameter. In other words, for
                every order metadata property value, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    For how many increments of the order metadata property to
                    grant points for.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                property:
                  type: string
                  description: Order metadata property.
      required:
        - type
        - calculation_type
        - order
    EarningRuleProportionalOrderItemsQuantity:
      title: Order Items Quantity
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_ITEMS_QUANTITY
          enum:
            - ORDER_ITEMS_QUANTITY
          description: >-
            `ORDER_ITEMS_QUANTITY`: Quantity of items defined in the
            `order_items.quantity.applicable_to` array or
            `order_items.quantity.object` & `.id` (X points for every Y items
            excluding free items).
        order_items:
          type: object
          required:
            - quantity
          properties:
            quantity:
              type: object
              required:
                - every
                - points
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every set of value (1, 10, etc)
                defined in the every parameter for the property defined in
                calculation_type, give the customer the number of points defined
                in the points parameter. In other words, for every
                calculation_type, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    Value is multiplied by 100 to precisely represent 2 decimal
                    places. For example, a $10 order amount is written as 1000.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                object:
                  type: string
                  description: >-
                    Type of object which will be covered by the earning rule.
                    This is required together with `id`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                  enum:
                    - products_collection
                    - product
                    - sku
                id:
                  type: string
                  description: >-
                    Unique ID of the resource assigned by Voucherify. This is
                    required together with `object`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                    Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for
                    product collection, `prod_0bae32322150fd0546` for a product,
                    or `sku_0b7d7dfb090be5c619` for a SKU.
                applicable_to:
                  type: array
                  description: >-
                    Defines products, SKUs, or product collections covered by
                    the earning rule. Can be replaced by `object` and `id` to
                    define only one object.
                  items:
                    type: object
                    properties:
                      object:
                        type: string
                        description: >-
                          Type of object which will be covered by the earning
                          rule.
                        enum:
                          - products_collection
                          - product
                          - sku
                      id:
                        type: string
                        description: >-
                          Unique ID of the resource assigned by Voucherify.
                          Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6`
                          for product collection, `prod_0bae32322150fd0546` for
                          a product, or `sku_0b7d7dfb090be5c619` for a SKU.
      required:
        - type
        - calculation_type
        - order_items
    EarningRuleProportionalOrderItemsAmount:
      title: Order Items Amount
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_ITEMS_AMOUNT
          enum:
            - ORDER_ITEMS_AMOUNT
          description: >-
            ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in
            the `order_items.quantity.applicable_to` array or
            `order_items.quantity.object` & `.id` (X points for every Y spent on
            items excluding discounts)
        order_items:
          type: object
          required:
            - amount
          properties:
            amount:
              type: object
              required:
                - every
                - points
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every set of value (1, 10, etc)
                defined in the every parameter for the property defined in
                calculation_type, give the customer the number of points defined
                in the points parameter. In other words, for every
                calculation_type, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    Value is multiplied by 100 to precisely represent 2 decimal
                    places. For example, a $10 order amount is written as 1000.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                object:
                  type: string
                  description: >-
                    Type of object which will be covered by the earning rule.
                    This is required together with `id`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                  enum:
                    - products_collection
                    - product
                    - sku
                id:
                  type: string
                  description: >-
                    Unique ID of the resource assigned by Voucherify. This is
                    required together with `object`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                    Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for
                    product collection, `prod_0bae32322150fd0546` for a product,
                    or `sku_0b7d7dfb090be5c619` for a SKU.
                applicable_to:
                  type: array
                  description: >-
                    Defines products, SKUs, or product collections covered by
                    the earning rule. Can be replaced by `object` and `id` to
                    define only one object.
                  items:
                    type: object
                    properties:
                      object:
                        type: string
                        description: >-
                          Type of object which will be covered by the earning
                          rule.
                        enum:
                          - products_collection
                          - product
                          - sku
                      id:
                        type: string
                        description: >-
                          Unique ID of the resource assigned by Voucherify.
                          Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6`
                          for product collection, `prod_0bae32322150fd0546` for
                          a product, or `sku_0b7d7dfb090be5c619` for a SKU.
      required:
        - type
        - calculation_type
        - order_items
    EarningRuleProportionalOrderItemsSubtotalAmount:
      title: Order Items Subtotal Amount
      type: object
      properties:
        type:
          type: string
          default: PROPORTIONAL
          enum:
            - PROPORTIONAL
          description: >-
            Defines how the points will be added to the loyalty
            card.PROPORTIONAL adds points based on a pre-defined ratio.
        calculation_type:
          type: string
          default: ORDER_ITEMS_SUBTOTAL_AMOUNT
          enum:
            - ORDER_ITEMS_SUBTOTAL_AMOUNT
          description: >-
            ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the
            order_items.subtotal_amount.object & .id (X points for every Y spent
            on items including discounts)
        order_items:
          type: object
          required:
            - subtotal_amount
          properties:
            subtotal_amount:
              type: object
              required:
                - every
                - points
              description: >-
                Defines the ratio based on the property defined in the
                calculation_type parameter. For every set of value (1, 10, etc)
                defined in the every parameter for the property defined in
                calculation_type, give the customer the number of points defined
                in the points parameter. In other words, for every
                calculation_type, give points.
              properties:
                every:
                  type: integer
                  description: >-
                    Value is multiplied by 100 to precisely represent 2 decimal
                    places. For example, a $10 order amount is written as 1000.
                points:
                  type: integer
                  description: >-
                    Number of points to be awarded, i.e. how many points to be
                    added to the loyalty card.
                points_formula:
                  type: string
                  description: Formula used to dynamically calculate the rewarded points.
                object:
                  type: string
                  description: >-
                    Type of object which will be covered by the earning rule.
                    This is required together with `id`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                  enum:
                    - products_collection
                    - product
                    - sku
                id:
                  type: string
                  description: >-
                    Unique ID of the resource assigned by Voucherify. This is
                    required together with `object`. Can be replaced by the
                    `applicable_to` array. In response, the value of the first
                    object is returned even if `applicable_to` array was used.
                    Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6` for
                    product collection, `prod_0bae32322150fd0546` for a product,
                    or `sku_0b7d7dfb090be5c619` for a SKU.
                applicable_to:
                  type: array
                  description: >-
                    Defines products, SKUs, or product collections covered by
                    the earning rule. Can be replaced by `object` and `id` to
                    define only one object.
                  items:
                    type: object
                    properties:
                      object:
                        type: string
                        description: >-
                          Type of object which will be covered by the earning
                          rule.
                        enum:
                          - products_collection
                          - product
                          - sku
                      id:
                        type: string
                        description: >-
                          Unique ID of the resource assigned by Voucherify.
                          Values are, for example, `pc_75U0dHlr7u75BJodrW1AE3t6`
                          for product collection, `prod_0bae32322150fd0546` for
                          a product, or `sku_0b7d7dfb090be5c619` for a SKU.
      required:
        - type
        - calculation_type
        - order_items
  securitySchemes:
    X-App-Id:
      type: apiKey
      name: X-App-Id
      in: header
    X-App-Token:
      type: apiKey
      name: X-App-Token
      in: header
    X-Voucherify-OAuth:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://api.voucherify.io/v1/oauth/token
          scopes:
            api: Gives access to whole server-side API.
            vouchers: >-
              Gives access to all endpoints and methods starting with
              `v1/vouchers`.
            client_api: Gives access to whole client-side API.
            client_vouchers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/vouchers`.
            promotions: >-
              Gives access to all endpoints and methods starting with
              `/v1/promotions`.
            client_promotions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/promotions`
            campaigns: >-
              Gives access to all endpoints and methods starting with
              `v1/campaigns`.
            client_publish: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/publish`.
            exports: >-
              Gives access to all endpoints and methods starting with
              `/v1/exports`.
            publications: >-
              Gives access to all endpoints and methods starting with
              `/v1/publications`.
            client_validate: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validate`.
            validations: >-
              Gives access to all endpoints and methods starting with
              `/v1/validations`.
            client_validations: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/validations`.
            qualifications: >-
              Gives access to all endpoints and methods starting with
              `/v1/qualifications`.
            client_qualifications: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/qualifications`.
            client_redeem: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redeem
            redemptions: >-
              Gives access to all endpoints and methods starting with
              `/v1/redemptions`.
            client_redemptions: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/redemptions`
            customers: >-
              Gives access to all endpoints and methods starting with
              `/v1/customers`.
            client_customers: >-
              Gives access to all endpoints and methods starting with
              `/client/v1/customers`.
            orders: >-
              Gives access to all endpoints and methods starting with
              `/v1/orders`.
            products: >-
              Gives access to all endpoints and methods starting with
              `/v1/products`.
            skus: >-
              Gives access to all endpoints and methods starting with
              `/v1/SKUs`.
            validation-rules: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules`.
            validation-rules-assignments: >-
              Gives access to all endpoints and methods starting with
              `/v1/validation-rules-assignments
            segments: >-
              Gives access to all endpoints and methods starting with
              `/v1/segments`.
            events: >-
              Gives access to all endpoints and methods starting with
              `/v1/events`.
            client_events: >-
              Gives access to all endpoints and methods starting with
              `client/v1/events`.
            rewards: >-
              Gives access to all endpoints and methods starting with
              `/v1/rewards`.
            assets: >-
              Gives access to all endpoints and methods starting with
              `/v1/assets`.
            task-results: >-
              Gives access to all endpoints and methods starting with
              `/v1/task-results`.
            loyalties: >-
              Gives access to all endpoints and methods starting with
              `/v1/loyalties`.
            client_consents: >-
              Gives access to all endpoints and methods starting with
              `client/v1/consents`.
            consents: >-
              Gives access to all endpoints and methods starting with
              `/v1/consents`.
            async-actions: >-
              Gives access to all endpoints and methods starting with
              `/v1/async-actions`.
            product-collections: >-
              Gives access to all endpoints and methods starting with
              `/v1/product-collections`.
            categories: >-
              Gives access to all endpoints and methods starting with
              `/v1/categories`.
            metadata-schemas: >-
              Gives access to all endpoints and methods starting with
              `/v1/metadata-schemas`.
            locations: >-
              Gives access to all endpoints and methods starting with
              `/v1/locations`.
            referrals: >-
              Gives access to all endpoints and methods starting with
              `/v1/referrals`.
            trash-bin: >-
              Gives access to all endpoints and methods starting with
              `/v1/trash-bin`.
            templates: >-
              Gives access to all endpoints and methods starting with
              `/v1/templates`.

````