Usage
MageSDK.getCustomerRewards().then(function(resp) {
if (resp.success) {
resp.data.customerRewards.forEach(function(reward) {
console.log(reward.discountCode, reward.status);
});
}
});
Response
boolean
Whether the request was successful.
array
List of redeemed rewards.
Show Customer reward properties
Show Customer reward properties
string
The customer reward ID.
string
Name of the reward that was redeemed.
string
Description of the reward.
number
Points spent to redeem this reward.
string
The generated Shopify discount code.
string | null
Type of discount (e.g.
"fixed", "percentage"), or null.string | null
A formatted display value such as
"$10 off" or "15% off", or null.string
Current status of the reward (
"ACTIVE", "USED", "EXPIRED").string
ISO 8601 timestamp of when the reward was redeemed.
string | null
ISO 8601 timestamp of when the discount code expires, or
null if it doesn’t expire.string | null
ISO 8601 timestamp of when the code was used, or
null if unused.string | null
Product image URL for free-product rewards, or
null.array
Variants the discount is restricted to, when applicable.
boolean
true for a standard redeemed reward.boolean
true when the reward came from being referred (the friend’s discount).boolean
true when the reward came from referring someone (the advocate’s reward).Sample response
{
"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
}
]
}
}