Voucher Object

Data model description

AttributesDescriptionExample
id

Assigned by the Voucherify API, identifies the voucher.

v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV

code

A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters.

WVPblOYX

campaign

A unique campaign name, identifies the voucher's parent campaign.

Gift Card Campaign

campaign_id

Assigned by the Voucherify API, identifies the voucher's parent campaign.

camp_FNYR4jhqZBM9xTptxDGgeNBV

category

Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.

category_id

Unique category ID assigned by Voucherify.

cat_0bb343dee3cdb5ec0c

categories

Contains details about the category.

[object Object]

type

Defines the type of voucher.

Available values: GIFT_VOUCHER, DISCOUNT_VOUCHER, LOYALTY_CARD
discountOne of: Reference to 1_obj_voucher_object_discount_amount Reference to 1_obj_voucher_object_discount_percentage Reference to 1_obj_voucher_object_discount_fixed Reference to [1_obj_voucher_object_discount_unit_one](#unit, single item) Reference to [1_obj_voucher_object_discount_unit_multiple](#unit, multiple items) Reference to 1_obj_voucher_object_discount_shipping
gift

Object representing gift parameters. Child attributes are present only if type is GIFT_VOUCHER. Defaults to null.

AttributesDescriptionExample
amount

Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

10000

balance

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

500

effect

Defines how the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
loyalty_card

Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD. Defaults to null.

AttributesDescriptionExample
points

Total points incurred over lifespan of loyalty card.

7000

balance

Points available for reward redemption.

6970

next_expiration_date

The next closest date when the next set of points are due to expire.

2023-05-30

next_expiration_points

The amount of points that are set to expire next.

start_date

Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.

2021-12-01T00:00:00.000Z

expiration_date

Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.

2021-12-31T00:00:00.000Z

validity_timeframe

Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.

AttributesDescriptionExample
duration

Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour.

PT1H

interval

Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day.

P2D

validity_day_of_week

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
Available values: 0, 1, 2, 3, 4, 5, 6
active

A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.

  • true indicates an active voucher
  • false indicates an inactive voucher
additional_info

An optional field to keep any extra textual information about the code such as a code description and details.

metadata

The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format.

assets

Stores links to images of QR and barcode that correspond to an encrypted voucher code.

AttributesDescriptionExample
qr

Stores Quick Response (QR) representation of encrypted code.

AttributesDescriptionExample
id

Encrypted voucher code ID.

U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==

url

URL to QR code

Optional: Attach query parameters to base URL to customize the image of the encrypted voucher code.

  • size: integer value from 1 to 100
  • format: string, either png (default) or svg

https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D

barcode

Stores barcode representation of encrypted code.

AttributesDescriptionExample
id

Encrypted voucher code ID.

U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==

url

URL to barcode

Optional: Attach query parameters to base URL to customize the image of the encrypted voucher code.

  • size: integer value from 1 to 100
  • format: string, either png (default) or svg

https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D

is_referral_code

Flag indicating whether this voucher is a referral code.

created_at

Timestamp representing the date and time when the voucher was created in ISO 8601 format.

2021-12-22T10:13:06.487Z

updated_at

Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.

2021-12-22T10:14:45.316Z

holder_id

Unique customer ID of voucher owner.

cust_eWgXlBBiY6THFRJwX45Iakv4

validation_rules_assignments

Stores information about validation rules assigned to the voucher.

AttributesDescriptionExample
object

The type of object represented is by default list.

data_ref

Identifies the name of the attribute that contains the array of validation rule assignments.

data

Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.

Array of:
AttributesDescriptionExample
id

Assigned by the Voucherify API, identifies the validation rule assignment.

asgm_N7t39epaQR2SkQcW

rule_id

Assigned by the Voucherify API, identifies the validation rule.

val_ssbxf1L9aKri

related_object_id

ID of the object from which the rule originates, can be the ID of the voucher itself or its parent campaign.

camp_AaP9MC1Y0GpBII84UTIuasvb

related_object_type

Which object does the rule originate from: the voucher itself or inherited from its parent campaign.

campaign

created_at

Timestamp representing the date and time when the validation rule was created in ISO 8601 format.

2022-02-14T15:12:06.817Z

object

The type of resource represented by the object. Default is validation_rules_assignment.

total

Total number of validation rules assigned to the voucher.

redemption

Stores a summary of redemptions that have been applied to the voucher.

AttributesDescriptionExample
quantity

How many times a voucher can be redeemed. A null value means unlimited.

redeemed_quantity

How many times a voucher has already been redeemed.

1

redeemed_amount

Total amount redeemed. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 balance is written as 10000.

100000

redeemed_points

Total loyalty points redeemed.

100000

object

The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.

url

The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions

/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10

publish

This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.

RequiredOptional
type:LOYALTY_CARDtype:DISCOUNT_VOUCHER
is_referral_code:truetype:GIFT_VOUCHER
AttributesDescriptionExample
object

The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.

count

Publication events counter.

0

url

The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications

/v1/vouchers/WVPblOYX/publications?page=1&limit=10

object

The type of object represented by JSON. Default is voucher.

Amount

AttributesDescriptionExample
type

Applies an amount discount.

amount_off

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. In case of the amount being calculated by the formula, i.e. the amount_off_formula parameter is present in the amount definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the amount off.

100

amount_off_formula

Formula used to calculate the discount.

effect

Defines how the discount is applied to the customer's order

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS, APPLY_TO_ITEMS_PROPORTIONALLY, APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY, APPLY_TO_ITEMS_BY_QUANTITY

Percentage

AttributesDescriptionExample
type

Applies a percentage discount.

amount_limit

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.

percent_off

Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the percent_off_formula parameter is present in the percent definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the percent off.

percent_off_formula

Formula used to calculate the discount.

effect

Defines how the discount is applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS

Fixed

AttributesDescriptionExample
type

Sets a fixed total on cart or item(s) and then calculates the discount to apply.

fixed_amount

Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the fixed_amount_formula parameter is present in the fixed amount definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.

1000

fixed_amount_formula

Formula used to calculate the discounted price of an item or a new order total.

effect
EffectDefinition
APPLY_TO_ORDERSets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15.
APPLY_TO_ITEMSSets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price.
Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS

Unit, single item

AttributesDescriptionExample
type

Applies a full value discount to item(s).

unit_off

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

1

unit_off_formula

Formula used to calculate the number of units.

unit_type

The product deemed as free, chosen from the product inventory (e.g. time, items).

prod_f1r5Tpr0DuC7

effect

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS

Unit, multiple items

AttributesDescriptionExample
type

Applies a full value discount to item(s).

effect

Defines the effect for adding multiple item types.

units

Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.

Array of:
AttributesDescriptionExample
unit_off

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

1

unit_off_formula

Formula used to calculate the number of units.

unit_type

The product deemed as free, chosen from the product inventory (e.g. time, items).

prod_f1r5Tpr0DuC7

effect

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS

Shipping

AttributesDescriptionExample
type

Applies a full value discount to item(s).

unit_off

Subtracts 1 shipping item from the subtotal.

unit_type

The shipping product deemed as free.

effect

Defines how the unit is added to the customer's order.

Language
URL
Click Try It! to start a request and see the response here!