Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.mageloyalty.com/llms.txt

Use this file to discover all available pages before exploring further.

Retrieve all active earning rules configured for the shop. Use this to display how customers can earn points.

Usage

MageSDK.getEarningRules().then(function(resp) {
  if (resp.success) {
    resp.data.earningRules.forEach(function(rule) {
      console.log(rule.name, rule.pointsToGive);
    });
  }
});

Response

success
boolean
Whether the request was successful.
data.earningRules
array
List of active earning rules.

Sample response

{
  "success": true,
  "data": {
    "earningRules": [
      {
        "id": "rule_abc",
        "name": "Points for purchase",
        "description": "Earn 10 points per \u00a31 spent",
        "action": "place_order",
        "category": "purchase",
        "isActive": true,
        "pointsToGive": 10,
        "customerFacingLabel": "Earn 10 points per \u00a31 spent",
        "callToActionUrl": null,
        "customerEarningRule": null
      }
    ]
  }
}