Search...
⌘KCreate and manage rewards that members can redeem with their loyalty points. This guide covers reward types, redemption flows, and catalog management.
Loyalty supports several reward types out of the box:
Discount Codes
Generate unique discount codes that members can apply at checkout.
Free Shipping
Offer free shipping as a redeemable reward for qualifying orders.
Free Products
Allow members to redeem points for free products from your catalog.
Exclusive Access
Gate premium content or early access features behind point redemption.
Define rewards in your program catalog using the rewards.create method:
typescript
const reward = await loyalty.rewards.create({
name: "20% Off Coupon",
type: "discount",
pointCost: 500,
value: {
discountType: "percentage",
discountValue: 20,
maxUses: 1,
expiresIn: 30, // days
},
availability: {
startDate: "2025-01-01",
endDate: "2025-12-31",
maxRedemptions: 1000,
},
});Process a reward redemption for a member:
typescript
const redemption = await loyalty.rewards.redeem({
memberId: "user_123",
rewardId: "reward_456",
});
console.log(redemption.code); // "LOYALTY-ABC123"
console.log(redemption.expiresAt); // "2025-02-15T00:00:00Z"
console.log(redemption.status); // "active"Balance check
The SDK automatically verifies the member has enough points before processing a redemption. An INSUFFICIENT_BALANCE error is thrown if the member's available balance is below the reward's point cost.
Fetch the reward catalog with optional filtering:
typescript
// Get all available rewards
const catalog = await loyalty.rewards.list({
status: "active",
sortBy: "pointCost",
order: "asc",
});
// Get rewards a specific member can afford
const affordable = await loyalty.rewards.listForMember("user_123");You can control which rewards are visible to different tier levels. For example, premium rewards can be restricted to Gold and Platinum members while still being visible to lower tiers as aspirational goals.