Earning rules

The Earning Rule object defines an action (event) that assigns a particular number of loyalty points to a customer's account. There are three types of events that you can use in earning rules:

  • a customer entered a segment
  • order paid event
  • custom event

The loyalty campaign will detect the first two events automatically when a customer enters a segment or when any of customer’s orders will be changed to PAID.

To trigger the 3rd option, you need specifically tell it so. You can achieve it with the Track Custom Event endpoint.


Event schema

To use a custom event in a loyalty program, we need to define it in the Schema beforehand.

Create earning rule

To create earning rule, define a required event, add a number of loyalty points and (optionally) a banner (name) of the rule.

curl -X POST \
-H "X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b" \
-H "X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c" \
-H "Content-Type: application/json" \
-d '[{
    "event": "order.paid",
    "validation_rule_id": null,
    "loyalty": {
        "points": 3
    "source": {
        "banner": "Yopu will get 3 points"
' \

When earning rules are ready, your customers can start collecting points. In the next step to a full-blown loyalty campaign, you need rewards that your customers can redeem in exchange for loyalty points.

If you have both earning rules and rewards ready, you can create a loyalty program.

Did this page help you?