Give item(s) for free – unit discount

How to add free items to customers' orders?

Voucherify enables you to offer products or shipping for free with a unit discount type. While creating a unique codes campaign, you can choose a unit discount type where the unit represents an item(s) that you want to offer for free.

As a result, when a customer is eligible for a promotion and redeems a code, the item(s) defined by the unit type will be automatically discounted.

Unit discount overview

To set up a unit discount via the dashboard, you need to provide the following information:

Unit value defines the number of free items attached to the code.
Unit type is a product offered for free chosen from your Product Inventory.

📘

Please note that this type of discount is based on the Product inventory added to the Products section in your dashboard. If you haven't synced your products yet, please follow this guide first.

Discount effect tells Voucherify if it should add items in number equal to the unit value to the cart or not.

There are two discount effects available with unit discount:

  • Always add new order items – results in adding items to the cart in number defined by unit value. For example, if the code gives one free t-shirt, then no matter if a customer has the t-shirt already in the cart or not, a free t-shirt will always be added to the order and discounted.

  • Add missing items to match total discount units count – the second option adds items to the cart only if a customer has fewer free items than offered to the code. For example, let's assume that the code gives one free t-shirt:

    – If a customer doesn't have the t-shirt already in the cart, then a free t-shirt will be added to the order.
    – If a customer already has this item in their cart, then the number of t-shirts already matches the units count. As a result, after applying the code, a discount will be applied to the item which is already in the cart and no items will be added.

Let's see how it works using the following example:

We're going to create two unique codes campaigns. In both examples, each coupon gives a free t-shirt to a customer but the chosen discount effect applied while redeeming the code is different.

Create a unique codes campaign with unit discount

Firstly, we need to create campaigns of unique codes, each code will have the value of one t-shirt.

📘

Note

There are many attributes and details you can customize while creating a campaign (start and expiration date, validation rules, and many more). If you're not familiar with all the options, please visit this guide first.

You can create this campaign in the dashboard (recommended) or use the Create Campaign method to do it via API.

Below, you can see two campaigns with the same unit discount and different discount effect.

{
    "name": "Get free T-shirt v1",
    "start_date": "2020-08-16T00:00:00Z",
    "expiration_date": "2021-12-26T00:00:00Z",
    "vouchers_count": 1,
    "voucher": {
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_NEW_ITEMS"
        },
         "redemption": {
          "quantity": 1
       }
    },
      "type": "AUTO_UPDATE"

}
{
    "id": "camp_ENtf8KXQmnwbLEw4IzHuICy3",
    "name": "Get free T-shirt v1",
    "campaign_type": "DISCOUNT_COUPONS",
    "type": "AUTO_UPDATE",
    "description": null,
    "start_date": "2020-08-16T00:00:00Z",
    "expiration_date": "2021-12-26T00:00:00Z",
    "activity_duration_after_publishing": null,
    "validity_timeframe": null,
    "validity_day_of_week": null,
    "metadata": {},
    "vouchers_count": 1,
    "vouchers_generation_status": "IN_PROGRESS",
    "active": true,
    "voucher": {
        "code_config": {
            "length": 8,
            "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
            "pattern": "########",
            "initialCount": 0
        },
        "type": "DISCOUNT_VOUCHER",
        "is_referral_code": false,
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_NEW_ITEMS"
        },
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00Z",
        "expiration_date": "2021-12-26T00:00:00Z",
        "redemption": {
            "quantity": 1
        }
    },
    "validation_rules_assignments": {
        "data": null,
        "object": "list",
        "total": 0,
        "data_ref": "data"
    },
    "promotion": {
        "object": "list",
        "data_ref": "tiers",
        "tiers": null,
        "has_more": false
    },
    "referral_program": null,
    "auto_join": false,
    "join_once": false,
    "use_voucher_metadata_schema": true,
    "object": "campaign"
}
  • Create Campaign with discount effect "Add missing items to match total discount units count"
{
    "name": "Get free T-shirt v2",
    "start_date": "2020-08-16T00:00:00Z",
    "expiration_date": "2021-12-26T00:00:00Z",
    "vouchers_count": 1,
    "voucher": {
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_MISSING_ITEMS"
        },
         "redemption": {
          "quantity": 1
       }
    },
      "type": "AUTO_UPDATE"

}
{
    "id": "camp_OiKND2py9nMzKZRjnHL0v1mP",
    "name": "Get free T-shirt v2",
    "campaign_type": "DISCOUNT_COUPONS",
    "type": "AUTO_UPDATE",
    "description": null,
    "start_date": "2020-08-16T00:00:00Z",
    "expiration_date": "2021-12-26T00:00:00Z",
    "activity_duration_after_publishing": null,
    "validity_timeframe": null,
    "validity_day_of_week": null,
    "metadata": {},
    "vouchers_count": 1,
    "vouchers_generation_status": "IN_PROGRESS",
    "active": true,
    "voucher": {
        "code_config": {
            "length": 8,
            "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
            "pattern": "########",
            "initialCount": 0
        },
        "type": "DISCOUNT_VOUCHER",
        "is_referral_code": false,
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_MISSING_ITEMS"
        },
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00Z",
        "expiration_date": "2021-12-26T00:00:00Z",
        "redemption": {
            "quantity": 1
        }
    },
    "validation_rules_assignments": {
        "data": null,
        "object": "list",
        "total": 0,
        "data_ref": "data"
    },
    "promotion": {
        "object": "list",
        "data_ref": "tiers",
        "tiers": null,
        "has_more": false
    },
    "referral_program": null,
    "auto_join": false,
    "join_once": false,
    "use_voucher_metadata_schema": true,
    "object": "campaign"
}

Publish voucher to a customer

Let's publish one of the unique codes from both campaigns to a customer.

{
    "campaign": { 
      "name": "Get free T-shirt v1", 
      "count": 1 
    },
    "customer": {
      "source_id": "[email protected]",
      "email": "[email protected]",
      "name": "John Smith"
    }
}
{
    "id": "pub_vBuPcbAvX6dIMZSx23Oif7Ct20fEEFqd",
    "object": "publication",
    "created_at": "2020-09-15T19:00:19.677Z",
    "customer_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
    "tracking_id": "[email protected]",
    "metadata": {},
    "channel": "API",
    "source_id": null,
    "result": "SUCCESS",
    "customer": {
        "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "name": "John Smith",
        "email": "[email protected]",
        "source_id": "[email protected]",
        "metadata": null,
        "object": "customer"
    },
    "voucher": {
        "id": "v_1KvYKAC4I5BZqY5WDKLkSJZAnbk5jTE0",
        "code": "KWdCs1uN",
        "campaign": "Get free T-shirt v1",
        "campaign_id": "camp_ENtf8KXQmnwbLEw4IzHuICy3",
        "category": null,
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "effect": "ADD_NEW_ITEMS",
            "unit_off": 1,
            "unit_type": "prod_xoOl0M0AGbmkLp"
        },
        "gift": null,
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00.000Z",
        "expiration_date": "2021-12-26T00:00:00.000Z",
        "validity_timeframe": null,
        "validity_day_of_week": null,
        "active": true,
        "additional_info": null,
        "metadata": {},
        "assets": {
            "qr": {
                "id": "U2FsdGVkX1/Kaz+iXPOpxgWfFxLzpvU9kdMNLRJwB1X7juz/hbCG/vdCmIZ9dXBV9mWo4lsnU7Z0+p7HxGIzyodFeVwYDOk27xBKGnG3ZsHYoDtAfS/oyUHkNK6K6PIuJL16uyfkxlNnBMbu+FKktA==",
                "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FKaz%2BiXPOpxgWfFxLzpvU9kdMNLRJwB1X7juz%2FhbCG%2FvdCmIZ9dXBV9mWo4lsnU7Z0%2Bp7HxGIzyodFeVwYDOk27xBKGnG3ZsHYoDtAfS%2FoyUHkNK6K6PIuJL16uyfkxlNnBMbu%2BFKktA%3D%3D"
            },
            "barcode": {
                "id": "U2FsdGVkX1+wXSyFzkb00jWi08kwxVFAalFJODvDhOS+BJFx9YhKUfJEAUqU18/LhPDZ7KUlyHmt2l+AE4CAoqsLbLc6nBkwf8+hjEIyawD1ixTFIX+9S5WvB3xTEBtpEo2DOJ1hj4UAFus1g5xesA==",
                "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BwXSyFzkb00jWi08kwxVFAalFJODvDhOS%2BBJFx9YhKUfJEAUqU18%2FLhPDZ7KUlyHmt2l%2BAE4CAoqsLbLc6nBkwf8%2BhjEIyawD1ixTFIX%2B9S5WvB3xTEBtpEo2DOJ1hj4UAFus1g5xesA%3D%3D"
            }
        },
        "is_referral_code": false,
        "created_at": "2020-09-15T19:00:19.688Z",
        "updated_at": null,
        "holder_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "object": "voucher",
        "publish": {
            "object": "list",
            "count": 1,
            "url": "/v1/vouchers/KWdCs1uN/publications?page=1&limit=10"
        },
        "redemption": {
            "object": "list",
            "quantity": 1,
            "redeemed_quantity": 0,
            "url": "/v1/vouchers/KWdCs1uN/redemptions?page=1&limit=10"
        }
    }
}
{
    "campaign": { 
      "name": "Get free T-shirt v2", 
      "count": 1 
    },
    "customer": {
      "source_id": "[email protected]",
      "email": "[email protected]",
      "name": "John Smith"
    }
}
{
    "id": "pub_ZojXUJMq7DLYaw9GO8yR7BNoxtnyGqhp",
    "object": "publication",
    "created_at": "2020-09-15T18:58:42.641Z",
    "customer_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
    "tracking_id": "[email protected]",
    "metadata": {},
    "channel": "API",
    "source_id": null,
    "result": "SUCCESS",
    "customer": {
        "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "name": "John Smith",
        "email": "[email protected]",
        "source_id": "[email protected]",
        "metadata": null,
        "object": "customer"
    },
    "voucher": {
        "id": "v_YtQTM5403ba3KDgiq2SO4KAATAxPKeYc",
        "code": "Lcu2Q7KC",
        "campaign": "Get free T-shirt v1",
        "campaign_id": "camp_ENtf8KXQmnwbLEw4IzHuICy3",
        "category": null,
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "effect": "ADD_NEW_ITEMS",
            "unit_off": 1,
            "unit_type": "prod_xoOl0M0AGbmkLp"
        },
        "gift": null,
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00.000Z",
        "expiration_date": "2021-12-26T00:00:00.000Z",
        "validity_timeframe": null,
        "validity_day_of_week": null,
        "active": true,
        "additional_info": null,
        "metadata": {},
        "assets": {
            "qr": {
                "id": "U2FsdGVkX18wJEBvLXeN0jbdQAVYwmQXdAv9w8t5zopjcBFmrq2myg6ZUowtq6Jd2dgTPvROAs967cwLw0maaODzoBhnue0H0WBJ8rlTSK2/xtwQlImKb312aGbhDu0PE/kLT1P1XRzsuQora/rxoA==",
                "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18wJEBvLXeN0jbdQAVYwmQXdAv9w8t5zopjcBFmrq2myg6ZUowtq6Jd2dgTPvROAs967cwLw0maaODzoBhnue0H0WBJ8rlTSK2%2FxtwQlImKb312aGbhDu0PE%2FkLT1P1XRzsuQora%2FrxoA%3D%3D"
            },
            "barcode": {
                "id": "U2FsdGVkX19dWgtDrsfi41JwujxWQFP2c7xeZfmQTNCiQ3lMj39oygUw+DAhlb1MNwKnG4kjUWllPDDbOS8onZYZk2AcDGCXaibE55z6/JfL4YkN0gmiiQ23LV+7fLn9m3712eouCwlBVOXy3zBT8g==",
                "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19dWgtDrsfi41JwujxWQFP2c7xeZfmQTNCiQ3lMj39oygUw%2BDAhlb1MNwKnG4kjUWllPDDbOS8onZYZk2AcDGCXaibE55z6%2FJfL4YkN0gmiiQ23LV%2B7fLn9m3712eouCwlBVOXy3zBT8g%3D%3D"
            }
        },
        "is_referral_code": false,
        "created_at": "2020-09-15T18:47:44.201Z",
        "updated_at": "2020-09-15T18:58:42.645Z",
        "holder_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "object": "voucher",
        "publish": {
            "object": "list",
            "count": 1,
            "url": "/v1/vouchers/Lcu2Q7KC/publications?page=1&limit=10"
        },
        "redemption": {
            "object": "list",
            "quantity": 1,
            "redeemed_quantity": 0,
            "url": "/v1/vouchers/Lcu2Q7KC/redemptions?page=1&limit=10"
        }
    }
}

Validate and redeem unit discount codes

Now, let's create an exemplary order to test different discount effects. Before redemption, you should invoke validate method for published vouchers to check if a customer and their cart match the promotion criteria.

{
    "customer" : {
      "id" : "cust_Jj3aDTzKJygmdxe20huwpDkn",
      "source_id" : "[email protected]",
      "name": "John Smith"
    },
    "order" : {
      "amount" : 2900,
      "items": [
        { "product_id": "prod_xoOl0M0AGbmkLp", "quantity": "1", "price": 2900 }
      ]
    }
  }
{
    "code": "KWdCs1uN",
    "discount": {
        "type": "UNIT",
        "unit_off": 1.0,
        "unit_type": "prod_xoOl0M0AGbmkLp",
        "effect": "ADD_NEW_ITEMS"
    },
    "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0",
    "metadata": {},
    "order": {
        "items": [
            {
                "object": "order_item",
                "product_id": "prod_xoOl0M0AGbmkLp",
                "quantity": 2,
                "amount": 5800,
                "discount_amount": 2900,
                "price": 2900
            }
        ],
        "amount": 2900,
        "object": "order"
    },
    "valid": true,
    "start_date": "2020-08-16T00:00:00Z",
    "expiration_date": "2021-12-26T00:00:00Z"
}

In the order object, you can see that the customer has already a t-shirt in their cart (it's the same product that our codes offer for free).

"order" : {
      "amount" : 2900,
      "items": [
        { "product_id": "prod_xoOl0M0AGbmkLp", "quantity": "1", "price": 2900 }
      ]
    }

Let's Redeem Vouchers from both campaigns and test the different discount effect.

Redemption of the code with discount effect ADD_NEW_ITEMS

In the response body, you can see that despite that one t-shirt is already in the cart, one additional t-shirt was added to the customer order and discounted.

{
    "customer" : {
      "id" : "cust_Jj3aDTzKJygmdxe20huwpDkn",
      "source_id" : "[email protected]",
      "name": "John Smith"
    },
    "order" : {
      "amount" : 2900,
      "items": [
        { "product_id": "prod_xoOl0M0AGbmkLp", "quantity": "1", "price": 2900 }
      ]
    }
  }
{
    "id": "r_0o5hjdizrqJF1kg4eOeMT1gq",
    "object": "redemption",
    "date": "2020-09-15T19:15:42Z",
    "customer_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
    "order": {
        "status": "PROCESSING",
        "customer": {
            "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
            "summary": {
                "redemptions": {
                    "total_redeemed": 0,
                    "total_failed": 0,
                    "total_succeeded": 0,
                    "total_rolled_back": 0,
                    "total_rollback_failed": 0,
                    "total_rollback_succeeded": 0,
                    "gift": {
                        "redeemed_amount": 0,
                        "amount_to_go": 0
                    },
                    "loyalty_card": {
                        "redeemed_points": 0,
                        "points_to_go": 0
                    }
                },
                "orders": {
                    "total_amount": 0,
                    "total_count": 0,
                    "average_amount": 0,
                    "last_order_amount": 0,
                    "last_order_date": null
                }
            },
            "loyalty": {
                "points": 0,
                "referred_customers": 0,
                "campaigns": {}
            },
            "object": "customer",
            "referrals": {
                "campaigns": [],
                "total": 0
            }
        },
        "items": [
            {
                "object": "order_item",
                "product_id": "prod_xoOl0M0AGbmkLp",
                "quantity": 2,
                "amount": 5800,
                "discount_amount": 2900,
                "price": 2900
            }
        ],
        "amount": 2900,
        "object": "order",
        "id": "ord_rTpYwEEDfLpzwM4HHDpqBOvm",
        "created_at": "2020-09-15T19:15:42Z"
    },
    "customer": {
        "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "source_id": "[email protected]",
        "name": "John Smith",
        "email": "[email protected]",
        "object": "customer"
    },
    "result": "SUCCESS",
    "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0",
    "voucher": {
        "id": "v_1KvYKAC4I5BZqY5WDKLkSJZAnbk5jTE0",
        "code": "KWdCs1uN",
        "campaign": "Get free T-shirt v1",
        "campaign_id": "camp_ENtf8KXQmnwbLEw4IzHuICy3",
        "category": null,
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_NEW_ITEMS"
        },
        "gift": null,
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00Z",
        "expiration_date": "2021-12-26T00:00:00Z",
        "validity_timeframe": null,
        "validity_day_of_week": null,
        "publish": {
            "object": "list",
            "count": 1,
            "url": "/v1/vouchers/KWdCs1uN/publications?page=1&limit=10"
        },
        "redemption": {
            "object": "list",
            "quantity": 1,
            "redeemed_quantity": 1,
            "url": "/v1/vouchers/KWdCs1uN/redemptions?page=1&limit=10"
        },
        "active": true,
        "additional_info": null,
        "metadata": {},
        "assets": {
            "qr": {
                "id": "U2FsdGVkX1/Kaz+iXPOpxgWfFxLzpvU9kdMNLRJwB1X7juz/hbCG/vdCmIZ9dXBV9mWo4lsnU7Z0+p7HxGIzyodFeVwYDOk27xBKGnG3ZsHYoDtAfS/oyUHkNK6K6PIuJL16uyfkxlNnBMbu+FKktA==",
                "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FKaz%2BiXPOpxgWfFxLzpvU9kdMNLRJwB1X7juz%2FhbCG%2FvdCmIZ9dXBV9mWo4lsnU7Z0%2Bp7HxGIzyodFeVwYDOk27xBKGnG3ZsHYoDtAfS%2FoyUHkNK6K6PIuJL16uyfkxlNnBMbu%2BFKktA%3D%3D"
            },
            "barcode": {
                "id": "U2FsdGVkX1+wXSyFzkb00jWi08kwxVFAalFJODvDhOS+BJFx9YhKUfJEAUqU18/LhPDZ7KUlyHmt2l+AE4CAoqsLbLc6nBkwf8+hjEIyawD1ixTFIX+9S5WvB3xTEBtpEo2DOJ1hj4UAFus1g5xesA==",
                "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BwXSyFzkb00jWi08kwxVFAalFJODvDhOS%2BBJFx9YhKUfJEAUqU18%2FLhPDZ7KUlyHmt2l%2BAE4CAoqsLbLc6nBkwf8%2BhjEIyawD1ixTFIX%2B9S5WvB3xTEBtpEo2DOJ1hj4UAFus1g5xesA%3D%3D"
            }
        },
        "is_referral_code": false,
        "referrer_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "holder_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "updated_at": "2020-09-15T19:15:42Z",
        "holder": {
            "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
            "source_id": "[email protected]",
            "name": "John Smith",
            "email": "[email protected]",
            "object": "customer"
        },
        "object": "voucher",
        "validation_rules_assignments": {
            "data": [],
            "object": "list",
            "total": 0,
            "data_ref": "data"
        }
    }
}

In the order items object, you can see that a free item was added to the cart.

Redemption of the code with discount effect ADD_MISSING_ITEMS

Now, let's use the same order while redeeming a discount code with the same value and different discount effect.

{
    "customer" : {
      "id" : "cust_Jj3aDTzKJygmdxe20huwpDkn",
      "source_id" : "[email protected]",
      "name": "John Smith"
    },
    "order" : {
      "amount" : 2900,
      "items": [
        { "product_id": "prod_xoOl0M0AGbmkLp", "quantity": "1", "price": 2900 }
      ]
    }
  }
{
    "id": "r_i3aoPZYuD6HSZZx3th4f7yl9",
    "object": "redemption",
    "date": "2020-09-15T19:23:51Z",
    "customer_id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
    "order": {
        "status": "PROCESSING",
        "customer": {
            "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
            "summary": {
                "redemptions": {
                    "total_redeemed": 0,
                    "total_failed": 0,
                    "total_succeeded": 0,
                    "total_rolled_back": 0,
                    "total_rollback_failed": 0,
                    "total_rollback_succeeded": 0,
                    "gift": {
                        "redeemed_amount": 0,
                        "amount_to_go": 0
                    },
                    "loyalty_card": {
                        "redeemed_points": 0,
                        "points_to_go": 0
                    }
                },
                "orders": {
                    "total_amount": 0,
                    "total_count": 0,
                    "average_amount": 0,
                    "last_order_amount": 0,
                    "last_order_date": null
                }
            },
            "loyalty": {
                "points": 0,
                "referred_customers": 0,
                "campaigns": {}
            },
            "object": "customer",
            "referrals": {
                "campaigns": [],
                "total": 0
            }
        },
        "items": [
            {
                "object": "order_item",
                "product_id": "prod_xoOl0M0AGbmkLp",
                "quantity": 1,
                "amount": 2900,
                "discount_amount": 2900,
                "price": 2900
            }
        ],
        "amount": 2900,
        "object": "order",
        "id": "ord_bURKtmAm3cKHGahlk8RaMjEs",
        "created_at": "2020-09-15T19:23:51Z"
    },
    "customer": {
        "id": "cust_M910OvSOzTMF4tR8Drs7mEeR",
        "source_id": "[email protected]",
        "name": "John Smith",
        "email": "[email protected]",
        "object": "customer"
    },
    "result": "SUCCESS",
    "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0",
    "voucher": {
        "id": "v_09l0SgL2vWL4K6dS9Wxs0VO0uU6fP3oO",
        "code": "10rfmNHj",
        "campaign": "Get free T-shirt v2",
        "campaign_id": "camp_OiKND2py9nMzKZRjnHL0v1mP",
        "category": null,
        "type": "DISCOUNT_VOUCHER",
        "discount": {
            "type": "UNIT",
            "unit_off": 1.0,
            "unit_type": "prod_xoOl0M0AGbmkLp",
            "effect": "ADD_MISSING_ITEMS"
        },
        "gift": null,
        "loyalty_card": null,
        "start_date": "2020-08-16T00:00:00Z",
        "expiration_date": "2021-12-26T00:00:00Z",
        "validity_timeframe": null,
        "validity_day_of_week": null,
        "publish": {
            "object": "list",
            "count": 0,
            "url": "/v1/vouchers/10rfmNHj/publications?page=1&limit=10"
        },
        "redemption": {
            "object": "list",
            "quantity": 1,
            "redeemed_quantity": 1,
            "url": "/v1/vouchers/10rfmNHj/redemptions?page=1&limit=10"
        },
        "active": true,
        "additional_info": null,
        "metadata": {},
        "assets": {
            "qr": {
                "id": "U2FsdGVkX19pCxGoLyltUsaGeCT5rEACaDzG4tOC2+0T2dum03wi1DsPNRgNNr44PKNyIWDzgEwq8blmi4qiaP2F20dGX6zDnL9TUgKfDNouCKzC21/VqTRDlu8lJbmECTuHVCrTicRDJw5b/l6r0Q==",
                "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pCxGoLyltUsaGeCT5rEACaDzG4tOC2%2B0T2dum03wi1DsPNRgNNr44PKNyIWDzgEwq8blmi4qiaP2F20dGX6zDnL9TUgKfDNouCKzC21%2FVqTRDlu8lJbmECTuHVCrTicRDJw5b%2Fl6r0Q%3D%3D"
            },
            "barcode": {
                "id": "U2FsdGVkX1/QHU3CWq119LxkwgjCQjM4+w0kqhw9fgxp6nS5PCMzvTNIHNBG2kRJl4S9oy1kbZdZVzW1z5gGb7NhBtvGiVnNAhSt3nBSi/DlrAs9QkfWBB6sVCVu/1BRTfSdbm9glp3kBtehdVH5kA==",
                "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FQHU3CWq119LxkwgjCQjM4%2Bw0kqhw9fgxp6nS5PCMzvTNIHNBG2kRJl4S9oy1kbZdZVzW1z5gGb7NhBtvGiVnNAhSt3nBSi%2FDlrAs9QkfWBB6sVCVu%2F1BRTfSdbm9glp3kBtehdVH5kA%3D%3D"
            }
        },
        "is_referral_code": false,
        "updated_at": "2020-09-15T19:23:51Z",
        "object": "voucher",
        "validation_rules_assignments": {
            "data": [],
            "object": "list",
            "total": 0,
            "data_ref": "data"
        }
    }
}

As you can see in the response body, the discount was applied to the product already added to the cart by a customer. The number of items in the cart matched the number of free units from the code so there were no additional items added by Voucherify.


Did this page help you?