pointsThe loyalty balance is plain points.store_creditThe loyalty balance is Mage store credit, denominated in money.
Store credit here means Mage’s internal store credit, not Shopify native store credit.
How each mode denominates values
Every loyalty number the SDK returns (points, lifetimePoints, redeemedPoints, a reward’s pointsCost, an earning rule’s award) is read in the shop’s loyalty unit:
Because the raw numbers look the same in both modes, never assume points. Read the mode and format through the helpers below.
Detecting the mode
Methods that carry loyalty amounts returnloyaltyMode and currency alongside their data. These are getCustomerDetails, getCustomerActivity, getShopRewards, getEarningRules, and getShopVipTiers.
formatLoyaltyValue call handles both modes, so your rendering code stays mode-agnostic. Pass the mode and currency straight through and let the helper decide.
Formatting helpers
The SDK exposes helpers onwindow.MageSDK so you never reimplement the unit math. Each one works in both modes.
Formats a loyalty value for display. Points mode returns the number with locale grouping (
"1,250"). Store-credit mode returns a localized currency string ("$12.50").Same as
formatLoyaltyValue but prefixes a + or - sign. Useful for activity rows ("+150", "+$3.00", "-300").Returns
"point" or "points" in points mode (based on count), and an empty string in store-credit mode, where the money value already describes itself.Normalizes any input to
'points' or 'store_credit'. Anything that isn’t exactly 'store_credit' resolves to 'points', so an older server or a missing value safely defaults to points.Convenience check. Returns
true when the resolved mode is 'store_credit'.Converts a minor-unit amount to major units (
300 becomes 3 for USD, 500 stays 500 for JPY). Relevant in store-credit mode when you need the raw number. For display, prefer formatLoyaltyValue.The storeCredit convenience object
In store-credit mode,getCustomerDetails attaches a ready-to-display storeCredit object to the customer. In points mode it is null, so you can branch on its presence.
The raw balance in minor units. Identical to
customer.points in store-credit mode.The balance in major units as a decimal string, e.g.
"4.50".A localized display string, e.g.
"$4.50".The ISO currency code.
Redemption differs by mode
Redemption is the one behavior that is not identical across modes. Points mode supports both redemption methods:redeemRewardforfixedrewards (a set cost for a set discount).redeemFlexibleforflexiblerewards (the customer chooses how much to spend).
redeemReward there returns:
redeemFlexible. A reward is redeemable this way when its redemptionMode is "flexible"; read the amount bounds from the reward’s flexibleConfig (minPoints / maxPoints).