> ## 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.

# getEarningRules

> List all active, storefront-visible earning rules for the shop.

Retrieve the active earning rules a customer can see, with points already boosted for the logged-in customer's VIP tier and any active bonus campaign. Use this to display how customers earn points. Pass the logged-in customer through the app proxy and the response reflects their personalized earning rates; for guests it returns base rates.

## Usage

```javascript theme={null}
MageSDK.getEarningRules().then(function(resp) {
  if (resp.success) {
    resp.data.earningRules.forEach(function(rule) {
      // `points` is the final award after tier and campaign boosts
      console.log(rule.name, rule.points);
    });
  }
});
```

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful.
</ResponseField>

<ResponseField name="data.earningRules" type="array">
  List of active earning rules.

  <Expandable title="Earning rule properties">
    <ResponseField name="id" type="string">
      The earning rule ID.
    </ResponseField>

    <ResponseField name="name" type="string">
      Internal name of the rule.
    </ResponseField>

    <ResponseField name="description" type="string">
      Description of how points are earned, reflecting the boosted value.
    </ResponseField>

    <ResponseField name="action" type="string">
      The trigger action (e.g. `"purchase"`, `"birthday"`, `"follow_on_instagram"`).
    </ResponseField>

    <ResponseField name="category" type="string">
      Rule category (e.g. `"purchase"`, `"social"`, `"engagement"`).
    </ResponseField>

    <ResponseField name="isActive" type="boolean">
      Whether the rule is currently active.
    </ResponseField>

    <ResponseField name="points" type="number">
      The final award after tier and campaign boosts. Display this value.
    </ResponseField>

    <ResponseField name="basePoints" type="number">
      The unboosted base award configured for the rule.
    </ResponseField>

    <ResponseField name="pointsToGive" type="number">
      The configured base award (same source as `basePoints`).
    </ResponseField>

    <ResponseField name="tierBoost" type="number | null">
      The VIP tier multiplier applied to this rule for the customer, or `null` if no tier boost applies.
    </ResponseField>

    <ResponseField name="campaignBoost" type="number | null">
      The active bonus-campaign multiplier applied to this rule, or `null` if none.
    </ResponseField>

    <ResponseField name="photoReviewPoints" type="number | null">
      Points awarded for a photo review, when the rule supports reviews.
    </ResponseField>

    <ResponseField name="videoReviewPoints" type="number | null">
      Points awarded for a video review, when the rule supports reviews.
    </ResponseField>

    <ResponseField name="customerFacingLabel" type="string | null">
      Label to display to customers.
    </ResponseField>

    <ResponseField name="callToActionUrl" type="string | null">
      Configured call-to-action URL, or `null`.
    </ResponseField>

    <ResponseField name="fullCallToActionUrl" type="string | null">
      The resolved, ready-to-use call-to-action URL.
    </ResponseField>

    <ResponseField name="customerEarningRule" type="object | null">
      The customer's specific earning record for this rule, or `null` if they haven't triggered it.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="data.loyaltyMode" type="string">
  `"points"` or `"store_credit"`. In store-credit mode award values are minor currency units. See [Loyalty modes](/js-sdk/loyalty-modes).
</ResponseField>

<ResponseField name="data.currency" type="string">
  The shop's ISO currency code.
</ResponseField>

<ResponseField name="data.tierInfo" type="object | null">
  Banner context when the customer's tier boosts earning, or `null`.

  <Expandable title="tierInfo properties">
    <ResponseField name="multiplier" type="number">
      The tier's earning multiplier.
    </ResponseField>

    <ResponseField name="name" type="string">
      The tier name, e.g. `"Gold"`.
    </ResponseField>

    <ResponseField name="mode" type="string">
      The multiplier mode.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="data.campaignInfo" type="object | null">
  Banner context for an active bonus campaign (`{ name, id }`), or `null`.
</ResponseField>

## Sample response

```json theme={null}
{
  "success": true,
  "data": {
    "earningRules": [
      {
        "id": "rule_abc",
        "name": "Points for purchase",
        "description": "Earn 15 points per £1 spent",
        "action": "purchase",
        "category": "purchase",
        "isActive": true,
        "points": 15,
        "basePoints": 10,
        "pointsToGive": 10,
        "tierBoost": 1.5,
        "campaignBoost": null,
        "photoReviewPoints": null,
        "videoReviewPoints": null,
        "customerFacingLabel": "Earn points on every order",
        "callToActionUrl": null,
        "fullCallToActionUrl": null,
        "customerEarningRule": null
      }
    ],
    "loyaltyMode": "points",
    "currency": "GBP",
    "tierInfo": {
      "multiplier": 1.5,
      "name": "Gold",
      "mode": "all"
    },
    "campaignInfo": null
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.