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 |
| ||||||||
segmentobject | Contains the ID of a customer segment. Required for the customer.segment.entered option in event.
| ||||||||
sourceobject | Contains the custom earning rule name and parent campaign.
| ||||||||
objectstring | The type of 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. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll 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. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default. | ||||||||
validity_timeframeobject | Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the
| ||||||||
validity_day_of_weekarray | Integer array corresponding to the particular days of the week in which the earning rule is valid.
| ||||||||
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. |
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. |
Calculate points proportionally
One of:
Order, Order Items, Customer Metadata, Earning Rule Proportional Custom Event
Earning Rule Event
Available values: order.paid
, customer.segment.entered
, custom_event
, customer.loyalty.tier.upgraded
, customer.loyalty.tier.downgraded
, customer.loyalty.tier.prolonged
, customer.loyalty.tier.joined
, customer.loyalty.tier.left
Order
One of:
Order Amount, Order Total Amount, Order Metadata
Order Items
One of:
Order Items Quantity, Order Items Amount, Order Items Subtotal Amount
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.
|
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 |
|
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 |
|
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 |
|