> ## 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.

# Redeem Promotion

> 
> ❗️ Deprecated  
>
> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](/api-reference/redemptions/redeem-stackable-discounts) introduces additional features and improvements while maintaining backward compatibility, including applying a combination of coupon codes and promotion tiers. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. 

To redeem a promotion, you create a redemption object passing a context.

You can retrieve a list of active promotions through the [Validate Promotions](/api-reference/validations/validate-promotion-tier) endpoint. That validation method will return a list of active​ promotion tiers identified by thier IDs. 

> 📘 Redemption rollback
>
> Do you need to undo a redemption? You can do it with [redemption rollback](/api-reference/redemptions/rollback-redemption).



## OpenAPI

````yaml /openapi/redemptions.json post /v1/promotions/tiers/{promotionTierId}/redemption
openapi: 3.0.1
info:
  title: Voucherify API - Redemptions
  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/promotions/tiers/{promotionTierId}/redemption:
    parameters:
      - schema:
          $ref: '#/components/schemas/ParameterPromotionTierId'
        name: promotionTierId
        in: path
        required: true
        description: ID of the promotion tier to be redeemed.
    post:
      tags:
        - Redemptions
      summary: Redeem Promotion
      description: >-

        > ❗️ Deprecated  

        >

        > This endpoint represents the deprecated version of the API responsible
        for promotion tier redemption, and we do not recommend using it. The new
        [Stackable Discounts
        API](/api-reference/redemptions/redeem-stackable-discounts) introduces
        additional features and improvements while maintaining backward
        compatibility, including applying a combination of coupon codes and
        promotion tiers. Developers are encouraged to migrate to the latest
        version to take advantage of the latest enhancements and bug fixes. No
        updates will be provided to the deprecated endpoint. 


        To redeem a promotion, you create a redemption object passing a context.


        You can retrieve a list of active promotions through the [Validate
        Promotions](/api-reference/validations/validate-promotion-tier)
        endpoint. That validation method will return a list of active​ promotion
        tiers identified by thier IDs. 


        > 📘 Redemption rollback

        >

        > Do you need to undo a redemption? You can do it with [redemption
        rollback](/api-reference/redemptions/rollback-redemption).
      operationId: redeem-promotion
      parameters: []
      requestBody:
        description: Provide the redemption context in the request body.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/7_req_redeem_promotion_tier'
            examples:
              One product one sku:
                value:
                  customer:
                    source_id: annie@lemon.com
                    name: Annie Lemon
                    email: annie@lemon.com
                  order:
                    amount: 200000
                    items:
                      - source_id: apple534
                        product_id: prod_anJ03RZZq74z4v
                        related_object: product
                        quantity: 2
                        price: 50000
                        product:
                          override: true
                          name: Apple iPhone 8
                          metadata:
                            shop: citycenter
                            category: electronics
                        metadata:
                          series: 2022-783CV
                      - sku_id: sku_0KtP4rvwEECQ2U
                        source_id: apple534-ihd5
                        related_object: sku
                        quantity: 1
                        price: 100000
                        sku:
                          override: true
                          sku: Apple iPad 10 Silver 64GB
                          metadata:
                            category: electronics
        required: true
      responses:
        '200':
          description: Returns a redemption object if the redeem operation succeeded.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/7_obj_redemption_object_promotion_tier_extended
              examples:
                One product one sku:
                  value:
                    id: r_0ca2699201c03f121b
                    object: redemption
                    date: '2023-03-21T05:49:00.807Z'
                    customer_id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                    tracking_id: track_VAVW6qltuo1/z+G2GI2LPw==
                    metadata: null
                    result: SUCCESS
                    order:
                      id: ord_IVEF85NZCXmP4S1fGmImSTwH
                      source_id: null
                      created_at: '2023-03-21T05:49:00.772Z'
                      updated_at: null
                      status: PAID
                      amount: 200000
                      discount_amount: 80000
                      total_discount_amount: 80000
                      total_amount: 120000
                      applied_discount_amount: 80000
                      total_applied_discount_amount: 80000
                      items:
                        - object: order_item
                          source_id: apple534
                          related_object: product
                          product_id: prod_anJ03RZZq74z4v
                          quantity: 2
                          amount: 100000
                          price: 50000
                          subtotal_amount: 100000
                          product:
                            id: prod_0c5d6689b39320059b
                            source_id: prod_anJ03RZZq74z4v
                            name: Apple iPhone 8
                            metadata:
                              shop: citycenter
                              category: electronics
                          metadata:
                            series: 2022-783CV
                        - object: order_item
                          source_id: apple534-ihd5
                          related_object: sku
                          sku_id: sku_0KtP4rvwEECQ2U
                          quantity: 1
                          amount: 100000
                          price: 100000
                          subtotal_amount: 100000
                          sku:
                            sku: Apple iPad 10 Silver 64GB
                            metadata:
                              category: electronics
                      metadata: {}
                      customer:
                        id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                        object: customer
                      customer_id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                      referrer_id: null
                      object: order
                      redemptions:
                        r_0ca2699201c03f121b:
                          date: '2023-03-21T05:49:00.807Z'
                          related_object_type: promotion_tier
                          related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                          related_object_parent_id: camp_w7BUstntAm8jbIDjfM49volj
                    channel:
                      channel_id: e55f3aaa-b303-421a-b562-ca8529ed341d
                      channel_type: API
                    customer:
                      id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                      name: Annie Lemon
                      email: annie@lemon.com
                      source_id: annie@lemon.com
                      metadata:
                        age: 2
                      object: customer
                    related_object_type: promotion_tier
                    related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                    voucher: null
                    promotion_tier:
                      id: promo_DE1N30D731Tg2F6NoMwNas2W
                      created_at: '2022-09-23T08:31:23.022Z'
                      updated_at: '2023-02-01T07:47:57.324Z'
                      name: Percent Discount
                      banner: Get 40% off
                      action:
                        discount:
                          type: PERCENT
                          percent_off: 40
                          effect: APPLY_TO_ORDER
                      metadata: {}
                      hierarchy: 2
                      campaign:
                        id: camp_w7BUstntAm8jbIDjfM49volj
                        start_date: '2019-08-16T00:00:00.000Z'
                        expiration_date: null
                        active: true
                        object: campaign
                      campaign_id: camp_w7BUstntAm8jbIDjfM49volj
                      active: true
                      start_date: '2022-09-21T00:00:00.000Z'
                      validity_day_of_week:
                        - 1
                        - 2
                        - 3
                        - 4
                        - 5
                      summary:
                        redemptions:
                          total_redeemed: 5
                        orders:
                          total_amount: 616000
                          total_discount_amount: 246400
                      object: promotion_tier
                      validation_rule_assignments:
                        object: list
                        data_ref: data
                        data:
                          - id: asgm_z6MvMg2Zf2UABNWN
                            rule_id: val_q8qUBMOh5qIQ
                            related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                            related_object_type: promotion_tier
                            object: validation_rules_assignment
                        total: 1
                      category_id: null
                      categories: []
                Example:
                  value:
                    id: r_0c64c10b8ece60bd91
                    object: redemption
                    date: '2023-02-01T08:25:22.235Z'
                    customer_id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                    tracking_id: track_VAVW6qltuo1/z+G2GI2LPw==
                    metadata: null
                    result: SUCCESS
                    order:
                      id: ord_7n58dbLV2jMG4C14XjEYEbjh
                      source_id: null
                      created_at: '2023-02-01T08:25:22.192Z'
                      updated_at: null
                      status: PAID
                      amount: 200000
                      discount_amount: 80000
                      total_discount_amount: 80000
                      total_amount: 120000
                      applied_discount_amount: 80000
                      total_applied_discount_amount: 80000
                      items:
                        - object: order_item
                          source_id: apple534
                          related_object: product
                          product_id: prod_anJ03RZZq74z4v
                          quantity: 2
                          amount: 100000
                          price: 50000
                          subtotal_amount: 100000
                          product:
                            id: prod_0c5d6689b39320059b
                            source_id: prod_anJ03RZZq74z4v
                            name: Apple iPhone 8
                            metadata:
                              shop: citycenter
                              category: electronics
                          metadata:
                            series: 2022-783CV
                        - object: order_item
                          source_id: apple534-ihd5
                          related_object: sku
                          sku_id: sku_0KtP4rvwEECQ2U
                          quantity: 1
                          amount: 100000
                          price: 100000
                          subtotal_amount: 100000
                          sku:
                            sku: Apple iPad 10 Silver 64GB
                            metadata:
                              category: electronics
                      metadata: {}
                      customer:
                        id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                        object: customer
                      customer_id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                      referrer_id: null
                      object: order
                      redemptions:
                        r_0c64c10b8ece60bd91:
                          date: '2023-02-01T08:25:22.235Z'
                          related_object_type: promotion_tier
                          related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                          related_object_parent_id: camp_w7BUstntAm8jbIDjfM49volj
                    customer:
                      id: cust_SolpIN5N4oZbCnrxZ5NHrbVB
                      name: Annie Lemon
                      email: annie@lemon.com
                      source_id: annie@lemon.com
                      metadata:
                        age: 2
                      object: customer
                    related_object_type: promotion_tier
                    related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                    voucher: null
                    promotion_tier:
                      id: promo_DE1N30D731Tg2F6NoMwNas2W
                      created_at: '2022-09-23T08:31:23.022Z'
                      updated_at: '2023-02-01T07:47:57.324Z'
                      name: Percent Discount
                      banner: Get 40% off
                      action:
                        discount:
                          type: PERCENT
                          percent_off: 40
                          effect: APPLY_TO_ORDER
                      metadata: {}
                      hierarchy: 2
                      campaign:
                        id: camp_w7BUstntAm8jbIDjfM49volj
                        start_date: '2019-08-16T00:00:00.000Z'
                        expiration_date: null
                        active: true
                        object: campaign
                      campaign_id: null
                      active: true
                      start_date: '2022-09-21T00:00:00.000Z'
                      validity_day_of_week:
                        - 1
                        - 2
                        - 3
                        - 4
                        - 5
                      summary:
                        redemptions:
                          total_redeemed: 3
                        orders:
                          total_amount: 408000
                          total_discount_amount: 163200
                      object: promotion_tier
                      validation_rule_assignments:
                        object: list
                        data_ref: data
                        data:
                          - id: asgm_z6MvMg2Zf2UABNWN
                            rule_id: val_q8qUBMOh5qIQ
                            related_object_id: promo_DE1N30D731Tg2F6NoMwNas2W
                            related_object_type: promotion_tier
                            object: validation_rules_assignment
                        total: 1
        '400':
          description: Returns an error if the promotion tier is inactive.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/e_error_expanded'
              examples:
                Inactive Promotion:
                  value:
                    code: 400
                    key: promotion_inactive
                    message: Inactive Promotion
                    details: >-
                      Promotion Tier with id: promo_DE1N30D731Tg2F6NoMwNas2W is
                      disabled.
                    request_id: v-0c64b722160294496b
                    resource_id: rf_0c64b7223cce60eec6
                    resource_type: redemption
                    error:
                      message: The promotion is inactive.
      deprecated: true
      security:
        - X-App-Id: []
          X-App-Token: []
        - X-Voucherify-OAuth:
            - api
            - promotions
components:
  schemas:
    ParameterPromotionTierId:
      type: string
      example: promo_2EnAik6Jt7dKTOMkRTIgEjZH
    7_req_redeem_promotion_tier:
      title: Redeem Promotion Tier
      type: object
      description: Redeem a promotion tier.
      properties:
        customer:
          oneOf:
            - $ref: '#/components/schemas/6_req_validate_voucher_customer_id'
            - $ref: '#/components/schemas/6_req_validate_voucher_customer_source_id'
            - $ref: '#/components/schemas/9_req_create_customer'
          description: Customer's information.
        order:
          oneOf:
            - $ref: '#/components/schemas/6_req_validate_voucher_order_id'
            - $ref: '#/components/schemas/6_req_validate_voucher_order_source_id'
            - $ref: '#/components/schemas/OrdersCreateRequestBody'
          description: Order information.
        metadata:
          type: object
          description: >-
            A set of key/value pairs that you can send in the request body to
            check against promotion tiers requiring **redemption** metadata
            validation rules to be satisfied. The validation runs against rules
            that are defined through the [Create Validation
            Rules](/api-reference/validation-rules/create-validation-rules)
            endpoint or via the Dashboard; in the _Advanced Rule Builder_ &rarr;
            _Advanced_ &rarr; _Redemption metadata satisfy_ or _Basic Builder_
            &rarr; _Attributes match_ &rarr; _REDEMPTION METADATA_. [Read
            more](/personalize/create-validation-rules).
    7_obj_redemption_object_promotion_tier_extended:
      type: object
      title: Promotion Tier
      description: This is an object representing a promotion tier redemption.
      properties:
        id:
          type: string
          example: r_0bc92f81a6801f9bca
          description: Unique redemption ID.
        object:
          type: string
          description: >-
            The type of the object represented by the JSON. This object stores
            information about the `redemption`.
          default: redemption
        date:
          type: string
          format: date-time
          example: '2022-10-03T12:24:58.008Z'
          description: Timestamp in ISO 8601 format indicating when the redemption occured.
        customer_id:
          type: string
          example: cust_i8t5Tt6eiKG5K79KQlJ0Vs64
          description: Unique customer ID of the redeeming customer.
        tracking_id:
          type: string
          example: track_fxEMFiLowFHg==
          description: Hashed customer source ID.
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes in the form of
            key/value pairs assigned to the redemption.
        result:
          type: string
          enum:
            - SUCCESS
            - FAILURE
          description: Redemption result.
        order:
          description: Defines the details of the order that is related to the redemption.
          allOf:
            - $ref: '#/components/schemas/7_obj_order_object'
        channel:
          type: object
          description: >-
            Defines the details of the channel through which the redemption was
            issued.
          properties:
            channel_id:
              type: string
              example: user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH
              description: >-
                Unique channel ID of the user performing the redemption. This is
                either a user ID from a user using the Voucherify Dashboard or
                an X-APP-Id of a user using the API.
            channel_type:
              type: string
              description: >-
                The source of the channel for the redemption. A `USER`
                corresponds to the Voucherify Dashboard and an `API` corresponds
                to the API.
              enum:
                - USER
                - API
        customer:
          type: object
          description: Defines the customer that is related to the redemption.
          properties:
            id:
              type: string
              description: The unique ID of a customer that is assigned by Voucherify.
              example: cust_eWgXlBBiY6THFRJwX45Iakv4
            name:
              type: string
              description: Customer's first and last name.
            email:
              type: string
              description: Customer's email address.
            source_id:
              type: string
              description: >-
                The merchant's customer ID if it is different from the
                Voucherify customer ID. It is really useful in case of an
                integration between multiple systems. It can be a customer ID
                from a CRM system, database or 3rd-party service.
            metadata:
              type: object
              description: >-
                The metadata object stores all custom attributes assigned to the
                customer. A set of key/value pairs that you can attach to a
                customer object. It can be useful for storing additional
                information about the customer in a structured format.
            object:
              type: string
              description: Type of object represented is `customer`.
              default: customer
        related_object_type:
          type: string
          description: Defines the related object.
          default: promotion_tier
          enum:
            - promotion_tier
        related_object_id:
          type: string
          description: >-
            Unique related object ID assigned by Voucherify, i.e.
            promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier.
        voucher:
          type: object
          nullable: true
        promotion_tier:
          description: Contains details of the promotion tier and the parent campaign.
          allOf:
            - $ref: '#/components/schemas/PromotionTier'
    e_error_expanded:
      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: redemption
        error:
          type: object
          description: Contains custom user-defined error message translation.
          properties:
            message:
              type: string
              description: >-
                Error message translation defined in Dashboard &rarr; Project
                Settings &rarr; Error Messages
    6_req_validate_voucher_customer_id:
      title: Customer ID
      description: You can pass the unique customer ID that was assigned by Voucherify.
      type: object
      properties:
        id:
          type: string
          description: >-
            The ID of an existing customer that will be linked to redemption in
            this request.
          example: cust_Vzck5i8U3OhcEUFY6MKhN9Rv
    6_req_validate_voucher_customer_source_id:
      title: Customer Source ID
      description: >-
        You can send the source ID that you used to create the customer in
        Voucherify.
      type: object
      properties:
        source_id:
          type: string
          description: >-
            A unique identifier of the customer who validates a voucher. It can
            be a customer ID or email from a CRM system, database, or a
            third-party service. If you also pass a customer ID (unique ID
            assigned by Voucherify), the source ID will be ignored.
    9_req_create_customer:
      type: object
      title: Customer
      description: This is an object containing information about the customer.
      properties:
        source_id:
          type: string
          description: >-
            The merchant's customer ID if it is different from the Voucherify
            customer ID. It is really useful in case of an integration between
            multiple systems. It can be a customer ID from a CRM system,
            database or 3rd-party service. 


            Please note that if you would like your data to sync based on the
            `source_id` of the customer, you need to define the `source_id`
            upfront. You will not be able to change or update the `source_id`
            later on.
        name:
          type: string
          description: Customer's first and last name.
        description:
          type: string
          description: An arbitrary string that you can attach to a customer object.
        email:
          type: string
          description: Customer's email address.
        phone:
          type: string
          description: >-
            Customer's phone number.  This parameter is mandatory when you try
            to send out codes to customers via an SMS channel.
        address:
          type: object
          description: Customer's address.
          properties:
            city:
              type: string
              description: City
            state:
              type: string
              description: State
            line_1:
              type: string
              description: First line of address.
            line_2:
              type: string
              description: Second line of address.
            country:
              type: string
              description: Country.
            postal_code:
              type: string
              description: Postal code.
        birthdate:
          type: string
          description: Customer's birthdate; format `YYYY-MM-DD`.
          format: date
        birthday:
          type: string
          description: '`Deprecated`. ~~Customer''s birthdate; format `YYYY-MM-DD`~~.'
          format: date
        metadata:
          type: object
          description: >-
            A set of custom key/value pairs that you can attach to a customer.
            The metadata object stores all custom attributes assigned to the
            customer. It can be useful for storing additional information about
            the customer in a structured format. This metadata can be used for
            validating whether the customer qualifies for a discount or it can
            be used in building customer segments. 
    6_req_validate_voucher_order_id:
      title: Order ID
      description: You can pass the unique order ID that was assigned by Voucherify.
      type: object
      properties:
        id:
          type: string
          description: >-
            Unique ID assigned by Voucherify of an existing order that will be
            linked to the redemption of this request.
    6_req_validate_voucher_order_source_id:
      title: Order Source ID
      description: >-
        You can send the source ID that you used to create the order in
        Voucherify.
      type: object
      properties:
        source_id:
          type: string
          description: >-
            Unique source ID of an existing order that will be linked to the
            redemption of this request.
    OrdersCreateRequestBody:
      title: Orders Create Request Body
      type: object
      description: Request body schema for **POST** `v1/orders`.
      allOf:
        - $ref: '#/components/schemas/Order'
        - title: Order Customer And Referrer Ids Objects
          type: object
          description: Order information.
          properties:
            created_at:
              type: string
              example: '2021-12-22T10:13:06.487Z'
              description: >-
                Timestamp representing the date and time when the order was
                created. The value is shown in the ISO 8601 format.
              format: date-time
            referrer_id:
              type: string
              nullable: true
              description: Unique referrer ID.
              example: cust_nM4jqPiaXUvQdVSA6vTRUnix
            customer:
              allOf:
                - $ref: '#/components/schemas/Customer'
            referrer:
              allOf:
                - $ref: '#/components/schemas/Referrer'
    7_obj_order_object:
      title: Order object
      description: >-
        This is an object representing an order with calculated discounts
        applied using the voucher code.
      oneOf:
        - $ref: '#/components/schemas/7_obj_order_object_apply_to_order'
        - $ref: '#/components/schemas/7_obj_order_object_apply_to_items'
    PromotionTier:
      type: object
      description: >-
        This is an object representing a promotion tier. Promotion tiers are
        always assigned to a campaign and cannot be used standalone.
      title: Promotion Tier
      properties:
        id:
          type: string
          example: promo_63fYCt81Aw0h7lzyRkrGZh9p
          description: Unique promotion tier ID.
        created_at:
          type: string
          example: '2021-12-15T11:34:01.333Z'
          format: date-time
          description: >-
            Timestamp representing the date and time when the promotion tier was
            created. The value is shown in the ISO 8601 format.
        updated_at:
          type: string
          example: '2022-02-09T09:20:05.603Z'
          format: date-time
          description: >-
            Timestamp representing the date and time when the promotion tier was
            updated. The value is shown in the ISO 8601 format.
        name:
          type: string
          description: Name of the promotion tier.
        banner:
          type: string
          description: Text to be displayed to your customers on your website.
        action:
          type: object
          description: Contains details about the discount applied by the promotion tier.
          properties:
            discount:
              $ref: '#/components/schemas/Discount'
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            promotion tier. A set of key/value pairs that you can attach to a
            promotion tier object. It can be useful for storing additional
            information about the promotion tier in a structured format.
        hierarchy:
          type: integer
          description: >-
            The promotions hierarchy defines the order in which the discounts
            from different tiers will be applied to a customer's order. If a
            customer qualifies for discounts from more than one tier, discounts
            will be applied in the order defined in the hierarchy.
        promotion_id:
          type: string
          description: Promotion unique ID.
        campaign:
          type: object
          description: Contains details about promotion tier's parent campaign.
          properties:
            id:
              type: string
              description: Unique campaign ID.
            start_date:
              type: string
              description: >-
                Activation timestamp defines when the campaign starts to be
                active in ISO 8601 format. Campaign is *inactive before* this
                date. 
              format: date-time
              example: '2022-09-22T00:00:00.000Z'
            expiration_date:
              type: string
              format: date-time
              description: >-
                Expiration timestamp defines when the campaign expires in ISO
                8601 format.  Campaign is *inactive after* this date.
              example: '2022-09-30T00:00:00.000Z'
            validity_timeframe:
              $ref: '#/components/schemas/ValidityTimeframe'
            validity_day_of_week:
              $ref: '#/components/schemas/ValidityDayOfWeek'
            validity_hours:
              $ref: '#/components/schemas/ValidityHours'
            active:
              type: boolean
              description: >-
                A flag indicating whether the campaign is active or not active.
                A campaign can be disabled even though it's within the active
                period defined by the `start_date` and `expiration_date` using
                the [Disable Campaign](/api-reference/disable-campaign)
                endpoint.  


                - `true` indicates an *active* campaign

                - `false` indicates an *inactive* campaign
            category_id:
              type: string
              example: cat_0b688929a2476386a6
              description: Unique category ID that this campaign belongs to.
            object:
              type: string
              description: >-
                The type of the object represented by the campaign object. This
                object stores information about the campaign.
              default: campaign
        campaign_id:
          type: string
          description: Promotion tier's parent campaign's unique ID.
        active:
          type: boolean
          description: >-
            A flag to toggle the promotion tier on or off. You can disable a
            promotion tier even though it's within the active period defined by
            the `start_date` and `expiration_date`.  


            - `true` indicates an *active* promotion tier

            - `false` indicates an *inactive* promotion tier
        start_date:
          type: string
          description: >-
            Activation timestamp defines when the promotion tier starts to be
            active in ISO 8601 format. Promotion tier is *inactive before* this
            date. 
          format: date-time
          example: '2022-09-23T00:00:00.000Z'
        expiration_date:
          type: string
          description: >-
            Activation timestamp defines when the promotion tier expires in ISO
            8601 format. Promotion tier is *inactive after* this date. 
          format: date-time
          example: '2022-09-26T00:00:00.000Z'
        validity_timeframe:
          $ref: '#/components/schemas/ValidityTimeframe'
        validity_day_of_week:
          $ref: '#/components/schemas/ValidityDayOfWeek'
        validity_hours:
          $ref: '#/components/schemas/ValidityHours'
        summary:
          type: object
          description: Contains statistics about promotion tier redemptions and orders.
          properties:
            redemptions:
              type: object
              description: Contains statistics about promotion tier redemptions.
              properties:
                total_redeemed:
                  type: integer
                  description: Number of times the promotion tier was redeemed.
            orders:
              type: object
              description: Contains statistics about orders related to the promotion tier.
              properties:
                total_amount:
                  type: integer
                  description: Sum of order totals.
                total_discount_amount:
                  type: integer
                  description: Sum of total discount applied using the promotion tier.
        object:
          type: string
          default: promotion_tier
          description: >-
            The type of the object represented by JSON. This object stores
            information about the promotion tier.
        validation_rule_assignments:
          $ref: '#/components/schemas/ValidationRuleAssignmentsList'
        category_id:
          type: string
          description: Promotion tier category ID.
          example: cat_0c9da30e7116ba6bba
        categories:
          type: array
          items:
            $ref: '#/components/schemas/Category'
    Order:
      title: Order
      type: object
      description: Order information.
      allOf:
        - type: object
          properties:
            id:
              type: string
              description: >-
                Unique ID assigned by Voucherify of an existing order that will
                be linked to the redemption of this request.
        - $ref: '#/components/schemas/OrderBase'
    Customer:
      title: Customer
      allOf:
        - type: object
          title: Customer Id And Source Id
          properties:
            id:
              type: string
              description: The ID of an existing customer.
            source_id:
              type: string
              description: >-
                A unique identifier of the customer who validates a voucher. It
                can be a customer ID or email from a CRM system, database, or a
                third-party service. If you also pass a customer ID (unique ID
                assigned by Voucherify), the source ID will be ignored.
        - $ref: '#/components/schemas/CustomerBase'
    Referrer:
      title: Referrer
      allOf:
        - $ref: '#/components/schemas/Customer'
    7_obj_order_object_apply_to_order:
      type: object
      title: 'Order object - Effect: Apply to order'
      description: >-
        This is an object representing an order with calculated discounts
        applied using the voucher code.
      properties:
        id:
          type: string
          example: ord_OLWs41pBk7VFn6ZTyX9U6keh
          description: Unique order ID, assigned by Voucherify.
        source_id:
          type: string
          description: >-
            The merchant's order ID if it is different from the Voucherify order
            ID. It is really useful in case of integration between multiple
            systems. It can be an order ID from CRM, database or 3rd party
            service.
        created_at:
          type: string
          format: date-time
          example: '2022-10-06T11:40:48.705Z'
          description: >-
            Timestamp representing the date and time when the order was created.
            The value is shown in the ISO 8601 format.
        updated_at:
          type: string
          format: date-time
          example: '2022-10-06T11:47:20.760Z'
          description: >-
            Timestamp representing the date and time when the order was updated.
            The value is shown in the ISO 8601 format.
        status:
          type: string
          description: Order status.
          enum:
            - CREATED
            - PAID
            - CANCELED
            - FULFILLED
        amount:
          type: integer
          description: Order amount before applying any discount.
        discount_amount:
          type: integer
          description: Sum of all order-level discounts applied to the order.
        total_discount_amount:
          type: integer
          description: >-
            Sum of all order-level AND all product-specific discounts applied to
            the order.  

            `total_discount_amount` = `discount_amount` +
            `items_discount_amount`
        total_amount:
          type: integer
          description: |-
            Order amount after applying all the discounts.  
            `total_amount` = `amount` - `total_discount_amount`
        applied_discount_amount:
          type: integer
          description: This field shows the order-level discount applied.
        total_applied_discount_amount:
          type: integer
          description: >-
            This field sums up all order-level and all product-specific
            discounts applied in a particular request.
        items:
          type: array
          description: >-
            Array of order items that have been applied to the order. Each order
            item can show the effects of particular discounts on the item-level.
          items:
            type: object
            properties:
              object:
                type: string
                default: order_item
                description: >-
                  The type of the object represented by JSON. This object stores
                  information about the `order_item`.
              product_id:
                type: string
                example: prod_5h0wc453_1
                description: >-
                  A unique identifier that represents the product and is
                  assigned by Voucherify.
              sku_id:
                type: string
                example: sku_prod_5h0wc453_1_1
                description: >-
                  A unique identifier that represents the SKU and is assigned by
                  Voucherify.
              quantity:
                type: integer
                description: Quantity of the item in the cart.
              amount:
                type: integer
                description: >-
                  Represents a total pre-discount amount of order item (`price`
                  * `quantity`).
              price:
                type: integer
                description: >-
                  Unit price of an item. The value is multiplied by 100 to
                  represent 2 decimal places. For example `10000 cents` for
                  `$100.00`.
              subtotal_amount:
                type: integer
                description: >-
                  Final order item amount after the applied item-level
                  discount.  If there are no item-level discounts applied, this
                  item is equal to the `amount`.   

                  `subtotal_amount`=`amount`-`discount_amount`
              product:
                type: object
                description: This object stores more information about the related product.
                properties:
                  id:
                    type: string
                    example: prod_5h0wc453_1
                    description: >-
                      A unique identifier that represents the product and is
                      assigned by Voucherify.
                  source_id:
                    type: string
                    description: A unique product identifier from your inventory system.
                    example: illy-arabica
                  name:
                    type: string
                    example: Brewing System
                    description: Product name.
                  price:
                    type: integer
                    description: >-
                      Unit price of a product. The value is multiplied by 100 to
                      represent 2 decimal places. For example `10000 cents` for
                      `$100.00`.
              sku:
                type: object
                description: This object stores more information about the related SKU.
                properties:
                  id:
                    type: string
                    example: sku_prod_5h0wc453_1_1
                    description: >-
                      A unique identifier that represents the SKU and is
                      assigned by Voucherify.
                  source_id:
                    type: string
                    example: illy-arabica-250g
                    description: A unique SKU identifier from your inventory system.
                  sku:
                    type: string
                    description: SKU name.
                  price:
                    type: integer
                    description: >-
                      Unit price of a SKU. The value is multiplied by 100 to
                      represent 2 decimal places. For example `10000 cents` for
                      `$100.00`.
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            order. A set of key/value pairs that are att to an order object.
            Stores additional information about the order in a structured
            format.
        customer:
          type: object
          description: >-
            Object containing information about the customer that is making the
            purchase.
          properties:
            id:
              type: string
              example: cust_7iUa6ICKyU6gH40dBU25kQU1
              description: >-
                Unique customer identifier of the customer making the purchase.
                The ID is assigned by Voucherify.
            object:
              type: string
              default: customer
              description: Type of object represented by the `customer` object.
        referrer:
          type: object
          description: Object containing information about the referrer.
          properties:
            id:
              type: string
              example: cust_7iUa6ICKyU6gH40dBU25kQU1
              description: >-
                Unique referrer ID, who referred the customer making the
                purchase.
            object:
              type: string
              default: customer
              description: Type of object represented by the `referrer` object.
        customer_id:
          type: string
          example: cust_7iUa6ICKyU6gH40dBU25kQU1
          description: >-
            Unique customer identifier of the customer making the purchase. The
            ID is assigned by Voucherify.
        referrer_id:
          type: string
          example: cust_nM4jqPiaXUvQdVSA6vTRUnix
          description: Unique referrer ID.
        object:
          type: string
          default: order
          description: >-
            The type of the object represented by JSON. This object stores
            information about the `order`.
        redemptions:
          description: Lists details related to the redemption.
          allOf:
            - $ref: '#/components/schemas/10_obj_order_object_unstacked_redemptions'
    7_obj_order_object_apply_to_items:
      type: object
      title: 'Order object - Effect: Apply to items'
      description: >-
        This is an object representing an order with calculated discounts
        applied using the voucher code.
      properties:
        id:
          type: string
          example: ord_OLWs41pBk7VFn6ZTyX9U6keh
          description: 'Unique order ID, assigned by Voucherify. '
        source_id:
          type: string
          description: >-
            The merchant's order ID if it is different from the Voucherify order
            ID. It is really useful in case of integration between multiple
            systems. It can be an order ID from CRM, database or 3rd party
            service.
        created_at:
          type: string
          format: date-time
          example: '2022-10-06T11:40:48.705Z'
          description: >-
            Timestamp representing the date and time when the order was created.
            The value is shown in the ISO 8601 format.
        updated_at:
          type: string
          format: date-time
          example: '2022-10-06T11:47:20.760Z'
          description: >-
            Timestamp representing the date and time when the order was updated.
            The value is shown in the ISO 8601 format.
        status:
          type: string
          description: Order status.
          enum:
            - CREATED
            - PAID
            - CANCELED
            - FULFILLED
        amount:
          type: integer
          description: Order amount before applying any discount.
        items_discount_amount:
          type: integer
          description: |-
            Sum of all product-specific discounts applied to the order.  
            `sum(items, i => i.discount_amount)`
        total_discount_amount:
          type: integer
          description: >-
            Sum of all order-level AND all product-specific discounts applied to
            the order.
        total_amount:
          type: integer
          description: |-
            Order amount after applying all the discounts.  
            `total_amount` = `amount` - `total_discount_amount`
        items_applied_discount_amount:
          type: integer
          description: Sum of all product-specific discounts applied.
        total_applied_discount_amount:
          type: integer
          description: >-
            Sum of all order-level AND all product-specific discounts applied to
            the order.
        items:
          type: array
          description: >-
            Array of order items that have been applied to the order. Each order
            item can show the effects of particular discounts on the item-level.
          items:
            type: object
            properties:
              object:
                type: string
                default: order_item
                description: >-
                  The type of the object represented by JSON. This object stores
                  information about the `order_item`.
              product_id:
                type: string
                example: prod_5h0wc453_1
                description: >-
                  A unique identifier that represents the product and is
                  assigned by Voucherify.
              sku_id:
                type: string
                example: sku_prod_5h0wc453_1_1
                description: >-
                  A unique identifier that represents the SKU and is assigned by
                  Voucherify.
              quantity:
                type: integer
                description: Quantity of the item in the cart.
              amount:
                type: integer
                description: >-
                  Represents a total pre-discount amount of order item (`price`
                  * `quantity`).
              discount_amount:
                type: integer
                description: The item-level discount applied to the item.
              applied_discount_amount:
                type: integer
                description: The item-level discount applied to the item.
              price:
                type: integer
                description: >-
                  Unit price of an item. The value is multiplied by 100 to
                  represent 2 decimal places. For example `10000 cents` for
                  `$100.00`.
              subtotal_amount:
                type: integer
                description: >-
                  Final order item amount after the applied item-level
                  discount.  If there are no item-level discounts applied, this
                  item is equal to the `amount`.   

                  `subtotal_amount`=`amount`-`discount_amount`
              product:
                type: object
                description: This object stores more information about the related product.
                properties:
                  id:
                    type: string
                    example: prod_5h0wc453_1
                    description: >-
                      A unique identifier that represents the product and is
                      assigned by Voucherify.
                  source_id:
                    type: string
                    description: A unique product identifier from your inventory system.
                    example: illy-arabica
                  name:
                    type: string
                    example: Brewing System
                    description: Product name.
                  price:
                    type: integer
                    description: >-
                      Unit price of a product. The value is multiplied by 100 to
                      represent 2 decimal places. For example `10000 cents` for
                      `$100.00`.
              sku:
                type: object
                description: This object stores more information about the related SKU.
                properties:
                  id:
                    type: string
                    example: sku_prod_5h0wc453_1_1
                    description: >-
                      A unique identifier that represents the SKU and is
                      assigned by Voucherify.
                  source_id:
                    type: string
                    example: illy-arabica-250g
                    description: A unique SKU identifier from your inventory system.
                  sku:
                    type: string
                    description: SKU name.
                  price:
                    type: integer
                    description: >-
                      Unit price of a SKU. The value is multiplied by 100 to
                      represent 2 decimal places. For example `10000 cents` for
                      `$100.00`.
        metadata:
          type: object
          description: >-
            The metadata object stores all custom attributes assigned to the
            order. A set of key/value pairs that are att to an order object.
            Stores additional information about the order in a structured
            format.
        customer:
          type: object
          description: >-
            Object containing information about the customer that is making the
            purchase.
          properties:
            id:
              type: string
              example: cust_7iUa6ICKyU6gH40dBU25kQU1
              description: >-
                Unique customer identifier of the customer making the purchase.
                The ID is assigned by Voucherify.
            object:
              type: string
              default: customer
              description: Type of object represented by the `customer` object.
        referrer:
          type: object
          description: Object containing information about the referrer.
          properties:
            id:
              type: string
              example: cust_7iUa6ICKyU6gH40dBU25kQU1
              description: >-
                Unique referrer ID, who referred the customer making the
                purchase.
            object:
              type: string
              default: customer
              description: Type of object represented by the `referrer` object.
        customer_id:
          type: string
          example: cust_7iUa6ICKyU6gH40dBU25kQU1
          description: >-
            Unique customer identifier of the customer making the purchase. The
            ID is assigned by Voucherify.
        referrer_id:
          type: string
          example: cust_nM4jqPiaXUvQdVSA6vTRUnix
          description: Unique referrer ID.
        object:
          type: string
          default: order
          description: >-
            The type of the object represented by JSON. This object stores
            information about the `order`.
        redemptions:
          description: Lists details related to the redemption.
          allOf:
            - $ref: '#/components/schemas/10_obj_order_object_unstacked_redemptions'
    Discount:
      title: Discount
      type: object
      description: Contains information about discount.
      oneOf:
        - $ref: '#/components/schemas/DiscountAmount'
        - $ref: '#/components/schemas/DiscountUnit'
        - $ref: '#/components/schemas/DiscountUnitMultiple'
        - $ref: '#/components/schemas/DiscountPercent'
        - $ref: '#/components/schemas/DiscountFixed'
    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'
    ValidationRuleAssignmentsList:
      type: object
      description: Validation Rule Assignments List
      title: Validation Rule Assignments List
      properties:
        object:
          type: string
          description: >-
            The type of the object represented by JSON. This object stores
            information about validation rule assignments.
          default: list
        data_ref:
          type: string
          description: >-
            Identifies the name of the JSON property that contains the array of
            validation rule assignments.
          default: data
        data:
          type: array
          description: A dictionary that contains an array of validation rule assignments.
          items:
            $ref: '#/components/schemas/ValidationRuleAssignment'
        total:
          type: integer
          description: Total number of validation rule assignments.
      required:
        - object
        - data_ref
        - data
        - total
    Category:
      title: Category
      description: This is an object representing a category.
      type: object
      properties:
        id:
          type: string
          description: Unique category ID assigned by Voucherify.
        name:
          type: string
          description: Category name.
        hierarchy:
          type: integer
          description: >-
            Category hierarchy. Categories with lower hierarchy are processed
            before categories with higher hierarchy value.
          minimum: 0
        object:
          type: string
          default: category
          enum:
            - category
          description: >-
            The type of the object represented by the JSON. This object stores
            information about the category.
        created_at:
          type: string
          description: >-
            Timestamp representing the date and time when the category was
            created. The value is shown in the ISO 8601 format.
          example: '2022-07-14T10:45:13.156Z'
          format: date-time
        updated_at:
          type: string
          example: '2022-08-16T10:52:08.094Z'
          description: >-
            Timestamp representing the date and time when the category was
            updated. The value is shown in the ISO 8601 format.
          format: date-time
      required:
        - id
        - name
        - hierarchy
        - created_at
        - object
    OrderBase:
      title: Order Base
      type: object
      description: Order information.
      properties:
        source_id:
          type: string
          nullable: true
          description: >-
            Unique source ID of an existing order that will be linked to the
            redemption of this request.


            For validation and redemption, if `source_id` is used with an
            existing order, the original order data will be used, like `items`,
            `amount`, and so on, not the one sent in the new request.
        status:
          type: string
          description: The order status.
          enum:
            - CREATED
            - PAID
            - CANCELED
            - FULFILLED
        amount:
          type: integer
          description: >-
            A positive integer in the smallest currency unit (e.g. 100 cents for
            $1.00) representing the total amount of the order. This is the sum
            of the order items' amounts.
        initial_amount:
          type: integer
          description: >-
            A positive integer in the smallest currency unit (e.g. 100 cents for
            $1.00) representing the total amount of the order. This is the sum
            of the order items' amounts.
        discount_amount:
          type: integer
          description: >-
            Sum of all order-level discounts applied to the order. It is
            expressed as an integer in the smallest currency unit (e.g. 100
            cents for $1.00).
        items:
          type: array
          description: Array of items applied to the order. It can include up to 500 items.
          items:
            $ref: '#/components/schemas/OrderItem'
        metadata:
          type: object
          description: >-
            A set of custom key/value pairs that you can attach to an order. It
            can be useful for storing additional information about the order in
            a structured format. It can be used to define business validation
            rules or discount formulas.
    CustomerBase:
      title: Customer Base
      type: object
      properties:
        name:
          type: string
          description: Customer's first and last name.
        description:
          type: string
          description: An arbitrary string that you can attach to a customer object.
        email:
          type: string
          description: Customer's email address.
        phone:
          type: string
          description: >-
            Customer's phone number. This parameter is mandatory when you try to
            send out codes to customers via an SMS channel.
        birthday:
          type: string
          description: '`Deprecated`. ~~Customer''s birthdate; format YYYY-MM-DD~~.'
          format: date
        birthdate:
          type: string
          description: Customer's birthdate; format YYYY-MM-DD.
          format: date
        address:
          type: object
          nullable: true
          description: Customer's address.
          properties:
            city:
              type: string
              description: City
            state:
              type: string
              description: State
            line_1:
              type: string
              description: First line of address.
            line_2:
              type: string
              description: Second line of address.
            country:
              type: string
              description: Country.
            postal_code:
              type: string
              description: Postal code.
        metadata:
          type: object
          description: >-
            A set of custom key/value pairs that you can attach to a customer.
            The metadata object stores all custom attributes assigned to the
            customer. It can be useful for storing additional information about
            the customer in a structured format. This metadata can be used for
            validating whether the customer qualifies for a discount or it can
            be used in building customer segments.
    10_obj_order_object_unstacked_redemptions:
      type: object
      title: Unstacked Redemption
      description: Redemption object representing a single redemption.
      properties:
        redemption_ID:
          type: object
          description: >-
            The property name is the unique redemption ID; i.e.
            `r_0ba186c4824e4881e1`. This object contains information about the
            redemption of an incentive.
          properties:
            date:
              type: string
              description: >-
                Timestamp representing the date and time when the redemption was
                created. The value is shown in the ISO 8601 format.
              example: '2022-09-02T17:06:56.649Z'
              format: date-time
            related_object_type:
              type: string
              description: The source of the incentive.
              enum:
                - voucher
                - promotion_tier
            related_object_id:
              type: string
              description: Unique ID of the related object that defines the incentive.
            related_object_parent_id:
              type: string
              description: >-
                Represent's the campaign ID of the voucher if the redemption was
                based on a voucher that was part of bulk codes generated within
                a campaign. In case of a promotion tier, this represents the
                campaign ID of the promotion tier's parent campaign.
    DiscountAmount:
      type: object
      title: Amount
      properties:
        type:
          type: string
          default: AMOUNT
          enum:
            - AMOUNT
          description: Defines the type of the voucher.
        amount_off:
          type: number
          description: >-
            Amount taken off the subtotal of a price. Value is multiplied by 100
            to precisely represent 2 decimal places. For example, a $10 discount
            is written as 1000.
        amount_off_formula:
          type: string
          description: Formula used to dynamically calculate the discount.
        aggregated_amount_limit:
          type: integer
          description: Maximum discount amount per order.
        effect:
          description: Defines how the discount is applied to the customer's order.
          allOf:
            - $ref: '#/components/schemas/DiscountAmountVouchersEffectTypes'
        is_dynamic:
          type: boolean
          description: Flag indicating whether the discount was calculated using a formula.
      required:
        - type
        - amount_off
    DiscountUnit:
      type: object
      title: Unit
      properties:
        type:
          type: string
          default: UNIT
          enum:
            - UNIT
          description: Discount type.
        unit_off:
          type: integer
          description: Number of units to be granted a full value discount.
        unit_off_formula:
          type: string
          description: Formula used to dynamically calculate the number of units.
        effect:
          description: Defines how the unit is added to the customer's order.
          allOf:
            - $ref: '#/components/schemas/DiscountUnitVouchersEffectTypes'
        unit_type:
          type: string
          description: >-
            The product deemed as free, chosen from product inventory (e.g.
            time, items).
        product:
          description: Contains information about the product.
          allOf:
            - $ref: '#/components/schemas/SimpleProductDiscountUnit'
        sku:
          $ref: '#/components/schemas/SimpleSkuDiscountUnit'
        is_dynamic:
          type: boolean
          description: Flag indicating whether the discount was calculated using a formula.
      required:
        - type
        - unit_type
    DiscountUnitMultiple:
      type: object
      title: Unit Multiple
      properties:
        type:
          type: string
          default: UNIT
          enum:
            - UNIT
          description: Discount type.
        effect:
          type: string
          default: ADD_MANY_ITEMS
          enum:
            - ADD_MANY_ITEMS
          description: Defines how the discount is applied to the customer's order.
        units:
          type: array
          items:
            $ref: '#/components/schemas/DiscountUnitMultipleOneUnit'
      required:
        - type
        - units
    DiscountPercent:
      type: object
      title: Percent
      properties:
        type:
          type: string
          default: PERCENT
          enum:
            - PERCENT
          description: Defines the type of the voucher.
        percent_off:
          type: number
          description: The percent discount that the customer will receive.
        percent_off_formula:
          type: string
          description: Formula used to dynamically calculate the discount.
        amount_limit:
          type: number
          description: >-
            Upper limit allowed to be applied as a discount. Value is multiplied
            by 100 to precisely represent 2 decimal places. For example, a $6
            maximum discount is written as 600.
        aggregated_amount_limit:
          type: integer
          description: Maximum discount amount per order.
        effect:
          description: Defines how the discount is applied to the customer's order.
          allOf:
            - $ref: '#/components/schemas/DiscountPercentVouchersEffectTypes'
        is_dynamic:
          type: boolean
          description: Flag indicating whether the discount was calculated using a formula.
      required:
        - type
        - percent_off
    DiscountFixed:
      title: Fixed
      type: object
      properties:
        type:
          type: string
          default: FIXED
          enum:
            - FIXED
          description: Defines the type of the voucher.
        fixed_amount:
          type: number
          description: >-
            Sets a fixed value for an order total or the item price. The value
            is multiplied by 100 to precisely represent 2 decimal places. For
            example, a $10 discount is written as 1000. If the fixed amount is
            calculated by the formula, i.e. the `fixed_amount_formula` parameter
            is present in the fixed amount definition, this value becomes the
            **fallback value**. As a result, if the formula cannot be calculated
            due to missing metadata, for example, this value will be used as the
            fixed value.
        fixed_amount_formula:
          type: string
          description: Formula used to dynamically calculate the discount.
        effect:
          description: Defines how the discount is applied to the customer's order.
          allOf:
            - $ref: '#/components/schemas/DiscountFixedVouchersEffectTypes'
        is_dynamic:
          type: boolean
          description: Flag indicating whether the discount was calculated using a formula.
      required:
        - type
        - fixed_amount
    ValidationRuleAssignment:
      title: Validation Rule Assignment
      type: object
      description: This is an object representing a validation rule assignment.
      properties:
        id:
          type: string
          example: asgm_74F7QZoYbUoljwQO
          description: Validation rule assignment ID.
        rule_id:
          type: string
          example: val_4j7DCRm2IS59
          description: Validation rule ID.
        related_object_id:
          type: string
          example: v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT
          description: The resource ID to which the validation rule was assigned.
        related_object_type:
          type: string
          description: The type of resource to which the validation rule was assigned.
          enum:
            - voucher
            - campaign
            - earning_rule
            - reward_assignment
            - promotion_tier
            - distribution
        created_at:
          type: string
          example: '2022-02-17T08:18:15.085Z'
          description: >-
            Timestamp representing the date and time when the validation rule
            assignment was created. The value is shown in the ISO 8601 format.
          format: date-time
        object:
          type: string
          default: validation_rules_assignment
          description: The type of the object represented by the ID.
          enum:
            - validation_rules_assignment
      required:
        - id
        - rule_id
        - related_object_id
        - related_object_type
        - created_at
        - object
    OrderItem:
      type: object
      title: Order Item
      properties:
        sku_id:
          type: string
          description: Unique identifier of the SKU. It is assigned by Voucherify.
        product_id:
          type: string
          description: Unique identifier of the product. It is assigned by Voucherify.
        related_object:
          type: string
          enum:
            - product
            - sku
          description: >-
            Used along with the source_id property, can be set to either sku or
            product.
        source_id:
          type: string
          description: >-
            The merchant's product/SKU ID (if it is different from the
            Voucherify product/SKU ID). It is useful in the integration between
            multiple systems. It can be an ID from an eCommerce site, a
            database, or a third-party service.
        quantity:
          type: integer
          description: The quantity of the particular item in the cart.
        discount_quantity:
          type: integer
          description: Number of dicounted items.
        initial_quantity:
          type: integer
          description: >-
            A positive integer in the smallest unit quantity representing the
            total amount of the order; this is the sum of the order items'
            quantity.
        amount:
          type: integer
          description: The total amount of the order item (price * quantity).
        discount_amount:
          type: integer
          description: Sum of all order-item-level discounts applied to the order.
        initial_amount:
          type: integer
          description: >-
            A positive integer in the smallest currency unit (e.g. 100 cents for
            $1.00) representing the total amount of the order. This is the sum
            of the order items' amounts.
        price:
          type: integer
          description: >-
            Unit price of an item. The value is multiplied by 100 to represent 2
            decimal places. For example `10000 cents` for `$100.00`.
        product:
          type: object
          description: An object containing details of the related product.
          properties:
            id:
              type: string
              description: >-
                A unique identifier that represents the product and is assigned
                by Voucherify.
            source_id:
              type: string
              description: >-
                The merchant's product ID (if it is different than Voucherify's
                product ID). It is really useful in case of integration between
                multiple systems. It can be an ID from an eCommerce site, a
                database or a 3rd party service.
            override:
              type: boolean
              description: >-
                The override set to `true` is used to store the product
                information in the system. If the product does not exist, it
                will be created with a source_id; if it does exist, the provided
                values for the name, price, and metadata will replace those
                already stored in the system. Override works only for endpoints
                that create an order in the database.
            name:
              type: string
              description: Product name.
            metadata:
              type: object
              description: >-
                A set of custom key/value pairs that you can attach to a
                product. It can be useful for storing additional information
                about the product in a structured format. It can be used to
                create product collections.
            price:
              type: number
              description: >-
                Product price. A positive integer in the smallest currency unit
                (e.g. 100 cents for $1.00).
        sku:
          type: object
          description: An object containing details of the related SKU.
          properties:
            id:
              type: string
              description: >-
                A unique identifier that represents the SKU and is assigned by
                Voucherify.
            source_id:
              type: string
              description: >-
                The merchant's SKU ID (if it is different than Voucherify's SKU
                ID). It is really useful in case of integration between multiple
                systems. It can be an ID from an eCommerce site, a database or a
                3rd party service.
            override:
              type: boolean
              description: >-
                The override set to `true` is used to store the product
                information in the system. If the product does not exist, it
                will be created with a source_id; if it does exist, the provided
                values for the name, price, and metadata will replace those
                already stored in the system.
            sku:
              type: string
              description: The SKU name.
            price:
              type: number
              description: >-
                SKU price. A positive integer in the smallest currency unit
                (e.g. 100 cents for $1.00).
            metadata:
              type: object
              description: >-
                A set of custom key/value pairs that you can attach to an order
                item. It can be useful for storing additional information about
                the order item in a structured format. It can be used to create
                product collections.
        metadata:
          type: object
          description: >-
            A set of custom key/value pairs that you can attach to an order
            item. It can be useful for storing additional information about the
            order item in a structured format. It can be used to define business
            validation rules.
      required:
        - object
    DiscountAmountVouchersEffectTypes:
      title: Discount Amount Vouchers Effect Types
      enum:
        - APPLY_TO_ORDER
        - APPLY_TO_ITEMS
        - APPLY_TO_ITEMS_PROPORTIONALLY
        - APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY
        - APPLY_TO_ITEMS_BY_QUANTITY
      type: string
    DiscountUnitVouchersEffectTypes:
      title: Discount Unit Vouchers Effect Types
      enum:
        - ADD_MISSING_ITEMS
        - ADD_NEW_ITEMS
        - ADD_MANY_ITEMS
        - ADD_SAME_ITEMS
      type: string
    SimpleProductDiscountUnit:
      type: object
      title: Simple Product Discount Unit
      properties:
        id:
          type: string
          description: Unique product ID, assigned by Voucherify.
        source_id:
          type: string
          description: Product's source ID.
        name:
          type: string
          description: Product name.
      required:
        - id
        - name
    SimpleSkuDiscountUnit:
      type: object
      title: Simple Sku Discount Unit
      properties:
        id:
          type: string
          description: Unique SKU ID, assigned by Voucherify.
        source_id:
          type: string
          description: Product variant's source ID.
        name:
          type: string
          description: Sku name
      required:
        - id
        - name
    DiscountUnitMultipleOneUnit:
      type: object
      title: One Unit
      properties:
        unit_off:
          type: number
          description: Number of units to be granted a full value discount.
        unit_off_formula:
          type: string
          description: Formula used to dynamically calculate the number of units.
        effect:
          type: string
          enum:
            - ADD_NEW_ITEMS
            - ADD_MISSING_ITEMS
          description: |+
            Defines how the unit is added to the customer's order.

        unit_type:
          type: string
          description: >-
            The product deemed as free, chosen from product inventory (e.g.
            time, items).
        product:
          description: Contains information about the product.
          allOf:
            - $ref: '#/components/schemas/SimpleProductDiscountUnit'
        sku:
          description: Contains information about the sku.
          allOf:
            - $ref: '#/components/schemas/SimpleSkuDiscountUnit'
      required:
        - effect
        - unit_type
    DiscountPercentVouchersEffectTypes:
      title: Discount Percent Vouchers Effect Types
      enum:
        - APPLY_TO_ORDER
        - APPLY_TO_ITEMS
      type: string
    DiscountFixedVouchersEffectTypes:
      title: Discount Fixed Vouchers Effect Types
      enum:
        - APPLY_TO_ORDER
        - APPLY_TO_ITEMS
      type: string
  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`.

````