Skip to main content
Rewards can be restricted to specific products. The division of labor:
  • Rigaly enforces: code validity, expiry, one-time use, cooldowns, time-of-day windows (time_active), points balance.
  • Your code enforces: which products the reward applies to — using the reward’s conditions text (or your own mapping keyed by reward ID).

1. Create the reward with machine-readable conditions

Put your product rule in conditions. Customers see this text in the app, and your checkout gets it back on validation — a simple convention like SKU: prefixes makes it parseable:
For more structure, keep a mapping in your own system keyed by the reward id (returned at creation) — e.g. { "9970514e-...": { "skuPattern": "^COF-M-" } } — and use conditions purely as customer-facing text.

2. At checkout: validate → check cart → complete

Why validate and complete separately?

Completing is irreversible — it deducts the customer’s points. Validating first lets you refuse the code (wrong products in the cart, store policy) before anything is consumed, so the customer keeps their points and can use the code elsewhere.