Publication Object

Data model description

AttributesDescriptionExample
id

Unique publication ID, assigned by Voucherify.

pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp

object

The type of object represented by the JSON. This object stores information about the publication.

created_at

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

2022-09-23T09:57:00.434Z

customer_id

Unique customer ID of the customer receiving the publication.

cust_eWgXlBBiY6THFRJwX45Iakv4

tracking_id

Customer's source_id.

metadata

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

channel

How the publication was originated. It can be your own custom channel or an example value provided here.

Available values: voucherify-website, Dashboard, Automation, API, Braze, Reward, SMS, Email, Activecampaign, Webhook, Intercom, Mailchimp, Shopify
source_id

The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service.

result

Status of the publication attempt.

Available values: SUCCESS, FAILURE
customer

Contains information about the customer to whom the publication was directed.

AttributesDescriptionExample
id

Unique customer ID, assigned by Voucherify.

cust_eWgXlBBiY6THFRJwX45Iakv4

name

Customer's name.

email

Customer's email.

source_id

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

A set of custom key/value pairs attached 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.

object

The type of object represented by the JSON. This object stores information about the customer.

voucher

Contains information about the voucher being published.

Any of:

Discount Voucher

AttributesDescriptionExample
code

Voucher code.

object

The type of object represented by the JSON. This object stores information about the voucher.

campaign

Name of voucher's parent campaign.

discountAny of:

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.

is_referral_code

Whether this voucher is a referral code.

Loyalty Card

AttributesDescriptionExample
code

Voucher code.

object

The type of object represented by the JSON. This object stores information about the voucher.

campaign

Name of voucher's parent campaign.

loyalty_card

Contains information about the loyalty card being published.

AttributesDescriptionExample
points

The incremental points to be added to the loyalty card as the initial balance on the card.

balance

The points balance after the incremental points are added to the loyalty card.

is_referral_code

Whether this voucher is a referral code.

Gift Card

AttributesDescriptionExample
code

Voucher code.

object

The type of object represented by the JSON. This object stores information about the voucher.

campaign

Name of voucher's parent campaign.

gift

Contains information about the gift card being published.

AttributesDescriptionExample
amount

The incremental amount to be added as the initial balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

balance

The credit balance on the gift card after the initial incremental amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

effect

How the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
is_referral_code

Whether this voucher is a referral code.

vouchers_id

Contains the unique internal voucher ID that was assigned by Voucherify.

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