Earning Rule
All of:- EarningRuleBase
-
Attributes Description validation_rule_id string
,null
A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance. updated_at string
,null
Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format. active boolean
A flag to toggle the earning rule on or off. You can disable an earning rule even though it’s within the active period defined by the start_date and expiration_date of the campaign or the earning rule’s own start_date and expiration_date.- true
indicates an active earning rulefalse
indicates an inactive earning rule |
EarningRuleBase
Attributes | Description |
---|---|
idstring | Assigned by the Voucherify API, identifies the earning rule object. |
created_atstring | Timestamp representing the date and time when the earning rule was created. The value is shown in the ISO 8601 format. |
loyalty | One of: Define fixed amount of points, Calculate points proportionally |
event | Defines the event which triggers the earning rule to add points to a loyalty card.Earning Rule Event |
custom_eventobject | Contains details about the custom event.Attributes Descriptionschema_idstring Unique identifier of the custom event schema |
segmentobject | Contains the ID of a customer segment. Required for the customer.segment.entered option in the event.Attributes Descriptionidstring
Contains a unique identifier of a customer segment. Assigned by the Voucherify API. |
loyalty_tierobject | Defines the tier associated with the earning rule definition.Attributes Descriptionidstring Unique loyalty tier ID associated with the earning rule. ANY: any loyalty tier within the campaign Example: ltr_pudTGWasuIqxdiDM0go31OV1 |
pending_pointsobject | Defines the configuration for pending points. Pending points can be used only with the order.paid event.Attributes Descriptionperiod_typestring
Defines the type of the period during which the points are in the pending state. Currently, only DAY value is accepted.
Available values: DAY
period_valueinteger
Defines for how long the points are in the pending state. The minimum value is 1, maximum is 90. |
sourceobject | Contains the custom earning rule name and parent campaign.Attributes Descriptionbannerstring Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard. object_idstring A unique campaign identifier assigned by the Voucherify API. object_typestring Defines the object associated with the earning rule. Defaults to campaign. Available values: campaign |
objectstring | The type of the object represented by JSON. Default is earning_rule.Available values: earning_rule |
automation_idstring | For internal use by Voucherify. |
start_datestring | Start date defines when the earning rule starts to be active. Activation timestamp is presented in the ISO 8601 format. The earning rule is inactive before this date. If you do not define the start date for an earning rule, it will inherit the campaign start date by default. |
expiration_datestring | Expiration date defines when the earning rule expires. Expiration timestamp is presented in the ISO 8601 format. The earning rule is inactive after this date. If you do not define the expiration date for an earning rule, it will inherit the campaign expiration date by default. |
validity_timeframe | See: Validity Timeframe |
validity_day_of_week | See: Validity Day Of Week |
validity_hours | See: Validity Hours |
metadataobject | The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format. |
expiration_rules | See: Earning Rule Expiration Rules |
Define fixed amount of points
Attributes | Description |
---|---|
typestring | The number of points to be added to the loyalty card.Available values: FIXED |
pointsinteger | Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points. |
points_formulastring | Formula used to dynamically calculate the rewarded points. |
Calculate points proportionally
One of: Define amount of points proportional to the order, Define amount of points proportional to order items, Define amount of points proportional to customer metadata, Earning Rule Proportional Custom EventEarning Rule Event
Validity Timeframe
Attributes | Description |
---|---|
durationstring | 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 |
intervalstring | 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 |
Validity Day Of Week
Integer array corresponding to the particular days of the week in which the voucher is valid.0
Sunday1
Monday2
Tuesday3
Wednesday4
Thursday5
Friday6
Saturday
Validity Hours
Attributes | Description |
---|---|
dailyarray | Defines the reccuring period(s) when the resource is active. The periods should not overlap.Array of:Attributes Descriptionstart_timestring Defines the starting hour of validity in the HH:mm format. The resource is inactive before this time. Example: 12:00 days_of_weekarray 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 expiration_timestring Defines the ending hour of validity in the HH:mm format. The resource is inactive after this time. Example: 14:00 |
Earning Rule Expiration Rules
Attributes | Description |
---|---|
period_typestring | Type of period. Can be set for MONTH or FIXED_DAY_OF_YEAR . MONTH requires the period_value field. FIXED_DAY_OF_YEAR requires the fixed_month and fixed_day fields.Available values: FIXED_DAY_OF_YEAR , MONTH |
period_valueinteger | Value of the period. Required for the period_type: MONTH . |
rounding_typestring | Type of rounding of the expiration period. Optional for the period_type: MONTH .Available values: END_OF_MONTH , END_OF_QUARTER , END_OF_HALF_YEAR , END_OF_YEAR , PARTICULAR_MONTH |
rounding_valueinteger | Value of rounding of the expiration period. Required for the rounding_type . |
fixed_monthinteger | Determines the month when the points expire; 1 is January, 2 is February, and so on. Required for the period_type: FIXED_DAY_OF_YEAR . |
fixed_dayinteger | Determines the day of the month when the points expire. Required for the period_type: FIXED_DAY_OF_YEAR . |
Define amount of points proportional to the order
One of: Order Amount, Order Total Amount, Order MetadataDefine amount of points proportional to order items
One of: Order Items Quantity, Order Items Amount, Order Items Subtotal AmountDefine amount of points proportional to customer metadata
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)Available values: CUSTOMER_METADATA |
customerobject | Attributes Descriptionmetadataobject Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. Attributes Descriptioneveryinteger For how many increments of the customer metadata property to grant points for. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. propertystring Customer metadata property. |
Earning Rule Proportional Custom Event
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute).Available values: CUSTOM_EVENT_METADATA |
custom_eventobject | Attributes Descriptionmetadataobject Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. Attributes Descriptioneveryinteger For how many increments of the customer metadata property to grant points for. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. propertystring Custom event metadata property. |
Order Amount
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_AMOUNT : Pre-discount order amount (X points for every Y spent excluding discounts)Available values: ORDER_AMOUNT |
orderobject | Attributes Descriptionamountobject Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. Attributes Descriptioneveryinteger Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. |
Order Total Amount
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_TOTAL_AMOUNT : Total order amount (X points for every Y spent including discount)Available values: ORDER_TOTAL_AMOUNT |
orderobject | Attributes Descriptiontotal_amountobject Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. Attributes Descriptioneveryinteger Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. |
Order Metadata
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_METADATA : Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)Available values: ORDER_METADATA |
orderobject | Defines the formula for calculating points proportionally.Attributes Descriptionmetadataobject Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points. Attributes Descriptioneveryinteger For how many increments of the order metadata property to grant points for. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. propertystring Order metadata property. |
Order Items Quantity
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_ITEMS_QUANTITY : Quantity of items defined in the order_items.quantity.applicable_to array or order_items.quantity.object & .id (X points for every Y items excluding free items).Available values: ORDER_ITEMS_QUANTITY |
order_itemsobject | Attributes Descriptionquantityobject Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. Attributes Descriptioneveryinteger Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. objectstring Type of object which will be covered by the earning rule. This is required together with id. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. This is required together with object. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. applicable_toarray Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by object and id to define only one object. Array of: Attributes Descriptionobjectstring Type of object which will be covered by the earning rule. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. |
Order Items Amount
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.quantity.applicable_to array or order_items.quantity.object & .id (X points for every Y spent on items excluding discounts)Available values: ORDER_ITEMS_AMOUNT |
order_itemsobject | Attributes Descriptionamountobject Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. Attributes Descriptioneveryinteger Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. objectstring Type of object which will be covered by the earning rule. This is required together with id. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. This is required together with object. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. applicable_toarray Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by object and id to define only one object. Array of: Attributes Descriptionobjectstring Type of object which will be covered by the earning rule. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. |
Order Items Subtotal Amount
Attributes | Description |
---|---|
typestring | Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio.Available values: PROPORTIONAL |
calculation_typestring | ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)Available values: ORDER_ITEMS_SUBTOTAL_AMOUNT |
order_itemsobject | Attributes Descriptionsubtotal_amountobject Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points. Attributes Descriptioneveryinteger Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000. pointsinteger Number of points to be awarded, i.e. how many points to be added to the loyalty card. points_formulastring Formula used to dynamically calculate the rewarded points. objectstring Type of object which will be covered by the earning rule. This is required together with id. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. This is required together with object. Can be replaced by the applicable_to array. In response, the value of the first object is returned even if applicable_to array was used. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. applicable_toarray Defines products, SKUs, or product collections covered by the earning rule. Can be replaced by object and id to define only one object. Array of: Attributes Descriptionobjectstring Type of object which will be covered by the earning rule. Available values: products_collection, product, sku idstring Unique ID of the resource assigned by Voucherify. Values are, for example, pc_75U0dHlr7u75BJodrW1AE3t6 for product collection, prod_0bae32322150fd0546 for a product, or sku_0b7d7dfb090be5c619 for a SKU. |