This entity describes an earning rule object.
Attribute | Description | Example |
---|---|---|
id | Assigned by the Voucherify API, identifies the earning rule object. |
|
created_at | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. |
|
updated_at | Timestamp representing the date and time when the earning rule was created in ISO 8601 format. |
|
object | A type of the object represented by JSON. The value is | |
validation_rule_id | A unique validation rule identifier that is verified before points are added to balance |
|
loyalty | An object that defines the number of points that will be added to a loyalty card and how the points will be added.
There are pre-defined calculations for point accrual on a
|
See below table for examples to calculate points proportionally. |
event | It can be one of these options:
|
|
custom_event | Required for the custom event option. Contains the ID of a custom event schema. |
|
segment | Required for the |
|
source | Contains the configuration for a campaign this earning rule belongs to. |
|
active | 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
| "active": true |
start_date | Activation timestamp in 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. | "start_date": "2022-02-02T13:00:00.000Z" |
expiration_date | Expiration timestamp in 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. | "expiration_date": "2022-03-03T14:30:00.000Z" |
validity_timeframe | Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.
| "validity_timeframe": { |
validity_day_of_week | Integer array corresponding to the particular days of the week in which the earning rule is valid.
| "validity_day_of_week": [ |
automation_id |
{
"id": "ern_P6MWOFGsv63sbTaTZBp0IHGK",
"created_at": "2022-02-02T13:18:32.557Z",
"updated_at": "2022-02-03T13:09:27.206Z",
"validation_rule_id": "val_6o0qdvlbh1mt",
"loyalty": {
"points": 1000,
"type": "FIXED"
},
"event": "order.paid",
"source": {
"banner": "Order paid 1000 points",
"object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3",
"object_type": "campaign"
},
"active": true,
"start_date": "2022-02-02T13:00:00.000Z",
"expiration_date": "2022-03-03T14:30:00.000Z",
"validity_timeframe": {
"duration": "PT1H",
"interval": "P1D"
},
"object": "earning_rule",
"automation_id": "auto_RVgObANuPToNla8LuD5aT3Zb"
}