Overview

SAP Hybris Loyalty enables organizations to create loyalty programs that deliver a premium customer experience to drive true brand loyalty. It is a loyalty solution that is tightly aligned with your business. It helps you enhance customer retention in a more meaningful way, while encouraging long-term advocacy and referrals.

Working with Rules

SAP Hybris Loyalty provides flexible configuration of your loyalty program by letting you configure rules to manage how the loyalty member is rewarded for his/her activities. There are standard conditions provided out of the box to cover most of the scenarios, but there could be cases where these standard conditions are not enough and you need something very specific for your use case.

A typical rule for a order scenario is shown in the screen grab below :

The above rule makes use of product attributes, to create a condition where the loyalty member earns 110 points if the product which he purchased is iPhone 6S. To create such a rule, the Loyalty Rule Builder UI provides product and order attributes as standard.

Not all conditions can be catered to using just product and order attributes. Thats where the custom attributes come in handy.

Using a Custom Attribute

Lets take an example, where the Loyalty Program administrator wants to award additional bonus points to members making orders from a specific store. This can be achieved by using a custom attribute in the Order rule.

A custom attribute is basically a key-value pair. The key and its value can be defined by the administrator. To realize the above example we can define a custom attribute with say, STORE_ID as a custom attribute key. There is no restriction on how you can define a key, provided that the same key is passed to Loyalty during runtime via the RESTful APIs.

After saving and activating the rule, you can now award bonus points to loyalty members who purchase from a store with id 123456. However, there is one more small step which needs to be done.

Pass the custom key and value

All the activities for the loyalty program are created using the /activities endpoint of loyalty member service of the Loyalty package. More details on the member service can be found here.
Make sure you pass the newly created custom key-value pair in the rulesPayload section. Take a look at the sample payload below:

{  
   "customerId":"C6833639868",
   "activityType":"ORDER",
   "transactionAmount":498,
   "refId":"0IMERU8K",
   "transactionCurrency":"USD",
   "rulesPayload":{  
      "customAttributes":[
         {
           "key":"STORE_ID",
           "value":"123456"
         }
       ],
      "productAttributes":[  
         {  
            "productId":"55893865522e1c22a57a18e3",
            "productName":"One Plus One",
            "price":199,
            "quantity":1,
            "imageURL":"https://api.yaas.io/hybris/media-repository/b1/saployaltybeta/hybris.product/media/5589386bb58ed9e32a899f25",
            "productCategory":[  
               {  
                  "name":"Mobiles",
                  "categoryId":"320610816"
               }
            ]
         }
      ],
      "orderAttributes":{  
         "total":0,
         "subTotal":498,
         "shippingAmount":"5.00",
         "discountAmount":"164.00",
         "shippingCountry":"US",
         "shippingState":"AL",
         "customAttributes":[  

         ]
      }
   }
}

Now whenever the custom attributes which are passed in the payload satisfy the conditions configured in the rule, the rule would execute and award the member accordingly.

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply