New — @loyalty/node official Node.js SDK is live

Rewards infrastructure that drives engagement at any scale.

One call to earn, one to redeem. Award points or a reward on any purchase, then redeem at the till — with campaigns that can also react to custom events. Register and get a test API key in minutes — no approval needed.

26K+Merchants
39M+Transactions
R7B+Points issued
<200msp99 latency

Request

POST /tenants/{tenantId}/transactions/evaluate
{
"transactionRef": "txn_demo_001",
"memberRef": "member_42",
"amount": 15000,
"storeRef": "store_sandton_01",
"products": [
{
"sku": "COFFEE-001",
"qty": 2,
"unitPrice": 5500,
"category": "beverages"
},
{
"sku": "MUFFIN-001",
"qty": 1,
"unitPrice": 4000,
"category": "food"
}
]
}

Response

Hit Run to see the response

Node.js SDK

Ship in minutes,
not hours.

The official Node.js SDK wraps every endpoint with full TypeScript types, automatic error handling, and built-in webhook signature verification. Zero dependencies. Native fetch.

loyalty.ts
import { LoyaltyClient } from '@loyalty/node';

const loyalty = new LoyaltyClient({
  tenantId: process.env.LOYALTY_TENANT_ID!,
  apiKey:   process.env.LOYALTY_API_KEY!,
});

// Award points for a R150 purchase — auto-creates member on first call
const result = await loyalty.evaluate({
  transactionRef: 'receipt_001',
  memberRef:      'customer_27821234567',
  amount:         15000,   // always in cents
});

console.log(result.pointsAwarded);  // 150
console.log(result.pointsBalance);  // 150

// Campaigns can also issue a coupon, gift card, or free item
console.log(result.campaigns[0].rewardIds);  // ['rwd_...'] when a reward fired

// Preview a redemption — no database writes
const quote = await loyalty.redeemQuote({
  memberRef:       'customer_27821234567',
  amount:          15000,
  pointsRequested: 100,
});

console.log(quote.discountAmount);  // 100 cents = R1.00

Points or tangible rewards

One evaluate call awards points, issues a coupon, gift card, free item, or discount voucher — or all at once. Ten campaign types, one response shape.

Idempotent by design

Retry safely with the same transactionRef — no double-awarding, ever.

Real-time webhooks

Subscribe to transaction.processed, reward.issued, and more. Signed HMAC-SHA256, retried with exponential backoff.

Multi-tenant

One platform, isolated per brand. Campaigns, budgets, and members fully scoped.

POPIA-ready

Consent tracking built in. GDPR-compatible by default.

Official Node.js SDK

npm install @loyalty/node — zero dependencies, native fetch, full TypeScript types out of the box.

Loyalty Engine — Developer Portal