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: EarningRuleFixed, Earning Rule Proportional | ||||||||
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.
| ||||||||
segmentobject | Contains the ID of a customer segment. Required for the
| ||||||||
loyalty_tierobject | Defines the tier associated with the earning rule definition.
| ||||||||
sourceobject | Contains the custom earning rule name and parent 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. |
EarningRuleFixed
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. |
Earning Rule Proportional
One of:
Earning Rule Proportional Order, Earning Rule Proportional Order Items, Earning Rule Proportional Customer Metadata, Earning Rule Proportional Custom Event
Earning 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 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 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:
|
Earning Rule Proportional Order
One of:
Order Amount, Order Total Amount, Order Metadata
Earning Rule Proportional Order Items
One of:
Earning Rule Proportional Order Items Quantity, Earning Rule Proportional Order Items Amount, Earning Rule Proportional Order Items Subtotal Amount
Earning Rule Proportional 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 |
|
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 |
|
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 | ||||||||||
orderobject |
|
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 | ||||||||||
orderobject |
|
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 | ||||||||||||
orderobject | Defines the formula for calculating points proportionally.
|
Earning Rule Proportional 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 | ||||||||||||||
order_itemsobject |
|
Earning Rule Proportional 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.amount.object & .id (X points for every Y spent on items excluding discounts) Available values:ORDER_ITEMS_AMOUNT | ||||||||||||||
order_itemsobject |
|
Earning Rule Proportional 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 |
|