Behio Storefront SDK
Customer

Loyalty

Read the customer's loyalty points, tier and program terms

Loyalty Summary

Requires customer authentication. Returns the shop's loyalty program terms and the logged-in customer's membership:

const { data } = await client.customer.getLoyalty();
// {
//   hasProgram: boolean,      // false = shop has no active program, hide the section
//   enrolled: boolean,        // false = show "join and earn" with program terms
//   program: LoyaltyProgram | null,   // pointName, pointValueRatio, currency, ...
//   balance: LoyaltyBalance | null,   // currentPoints, currentPointsValue, lifetime stats
//   currentTier: LoyaltyTier | null,  // name, slug, color, earnMultiplier, perks
//   nextTier: LoyaltyNextTier | null, // threshold progress towards the next tier
//   referralCode: string | null,
//   transactions: LoyaltyTransaction[], // recent point movements
// }

LoyaltyTier.perks is { list: string[] } | null with human-readable perk lines to render on the tier card.

Redeeming Points

Show the available balance on the checkout and pass the chosen amount as redeemLoyaltyPoints in checkout.createOrder. The backend validates the redemption against the real balance, the program's minRedemptionPoints and maxRedemptionPercent, so never trust the UI value.

React Hook

import { useLoyalty } from '@behio/storefront-sdk/react';

const { data, isLoading } = useLoyalty();
if (!data?.hasProgram) return null;

On this page