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

# getCustomerRewards

> List the logged-in customer's redeemed rewards and discount codes.

Retrieve all rewards that the currently logged-in customer has redeemed, including their discount codes and statuses.

## Usage

```javascript theme={null}
MageSDK.getCustomerRewards().then(function(resp) {
  if (resp.success) {
    resp.data.customerRewards.forEach(function(reward) {
      console.log(reward.discountCode, reward.status);
    });
  }
});
```

## Response

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

<ResponseField name="data.customerRewards" type="array">
  List of redeemed rewards.

  <Expandable title="Customer reward properties">
    <ResponseField name="id" type="string">
      The customer reward ID.
    </ResponseField>

    <ResponseField name="rewardName" type="string">
      Name of the reward that was redeemed.
    </ResponseField>

    <ResponseField name="rewardDescription" type="string">
      Description of the reward.
    </ResponseField>

    <ResponseField name="points" type="number">
      Points spent to redeem this reward.
    </ResponseField>

    <ResponseField name="discountCode" type="string">
      The generated Shopify discount code.
    </ResponseField>

    <ResponseField name="discountType" type="string | null">
      Type of discount (e.g. `"fixed"`, `"percentage"`), or `null`.
    </ResponseField>

    <ResponseField name="discountValue" type="string | null">
      A formatted display value such as `"$10 off"` or `"15% off"`, or `null`.
    </ResponseField>

    <ResponseField name="status" type="string">
      Current status of the reward (`"ACTIVE"`, `"USED"`, `"EXPIRED"`).
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp of when the reward was redeemed.
    </ResponseField>

    <ResponseField name="expiresAt" type="string | null">
      ISO 8601 timestamp of when the discount code expires, or `null` if it doesn't expire.
    </ResponseField>

    <ResponseField name="discountCodeRedeemedAt" type="string | null">
      ISO 8601 timestamp of when the code was used, or `null` if unused.
    </ResponseField>

    <ResponseField name="productImage" type="string | null">
      Product image URL for free-product rewards, or `null`.
    </ResponseField>

    <ResponseField name="validVariants" type="array">
      Variants the discount is restricted to, when applicable.
    </ResponseField>

    <ResponseField name="isCustomerReward" type="boolean">
      `true` for a standard redeemed reward.
    </ResponseField>

    <ResponseField name="isReferral" type="boolean">
      `true` when the reward came from being referred (the friend's discount).
    </ResponseField>

    <ResponseField name="isReferrer" type="boolean">
      `true` when the reward came from referring someone (the advocate's reward).
    </ResponseField>
  </Expandable>
</ResponseField>

## Sample response

```json theme={null}
{
  "success": true,
  "data": {
    "customerRewards": [
      {
        "id": "cr_abc123",
        "rewardName": "\u00a35 off your next order",
        "rewardDescription": "\u00a35 off your order",
        "points": 500,
        "discountCode": "MAGE-XYZ789",
        "discountType": "fixed",
        "discountValue": "£5 off",
        "status": "ACTIVE",
        "createdAt": "2024-06-01T12:00:00.000Z",
        "expiresAt": "2024-07-01T12:00:00.000Z",
        "discountCodeRedeemedAt": null,
        "isCustomerReward": true
      }
    ]
  }
}
```


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