Loyalty Events
Loyalty events represent customer actions that can trigger point awards, promotion evaluations, and workflow executions.
Event Model
Section titled “Event Model”| Field | Type | Description |
|---|---|---|
event | string | Event type (e.g., purchase, signup) |
customerId | string | The customer who performed the action |
amount | number | Monetary value (in cents) if applicable |
metadata | object | Additional event data |
timestamp | datetime | When the event occurred |
Sending Events
Section titled “Sending Events”Use the ingest endpoint for high-throughput event tracking:
curl -X POST https://api.storelayer.io/ingest/events \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "event": "purchase", "customerId": "cust_123", "amount": 4999, "metadata": { "orderId": "ord_456", "items": ["sku_a", "sku_b"] } }'Built-in Event Types
Section titled “Built-in Event Types”| Event | Description |
|---|---|
purchase | A completed purchase |
signup | New customer registration |
referral | Successful referral |
review | Product review submitted |
birthday | Customer birthday (auto-triggered) |
You can also define custom events for any action specific to your business.
Event Processing
Section titled “Event Processing”Events are processed through Cloudflare Queues with guaranteed delivery:
- Event received via ingest API
- Queued for processing (batch size: 10, timeout: 5s)
- Evaluated against active promotions and workflows
- Rewards applied automatically