Loyalty Audit & Correction Workflow

When a member’s points/XP need manual verification (e.g., wrong tier at signup, missed multiplier), use the Payload REST API on prod (https://dungeon.club).

Auth

Use PAYLOAD_API_KEY from .env with header: Authorization: users API-Key <key>

Steps

  1. Fetch member: GET /api/members/{id} — note loyaltyPoints, xp, tier, earnMultiplier
  2. Fetch loyalty transactions: GET /api/loyalty-transactions?where[member][equals]={id}&sort=-createdAt&limit=100
  3. Fetch purchases: GET /api/purchases?where[member][equals]={id}&sort=purchasedAt&limit=100
  4. Fetch check-ins: GET /api/check-ins?where[member][equals]={id}&sort=-createdAt&limit=100
  5. Verify each transaction’s math (see formulas below)
  6. Sum all transaction points and XP — compare against member record totals
  7. Patch corrections:
    • Transaction: PATCH /api/loyalty-transactions/{id} with corrected xp, metadata
    • Member: PATCH /api/members/{id} with corrected xp and/or loyaltyPoints

Points & XP formulas

SourcePointsXP
Purchasefloor(totalMoney × tier.earnMultiplier)floor(points × buffMultiplier)
Check-in100 (fixed, no tier multiplier)floor(100 × buffMultiplier)
Eventas awarded (no tier multiplier)floor(points × buffMultiplier)
Backfill1x multiplier (pre-membership)same as points

Common gotchas

  • Buff applies to tier-adjusted points, not raw cents. E.g., $3.00 at 1.5x Bronze = 450 pts. With 3x buff, XP = 1,350 (not 900).
  • Backfilled purchases intentionally use 1x — they predate membership.
  • Member totals don’t auto-recalculate after editing a transaction — update them manually.
  • Transaction metadata goes stale after manual edits — update earnMultiplier, buffApplied.baseXp, buffApplied.buffedXp too.
  • URL brackets need percent-encoding in curl ([%5B, ]%5D).