/tenants/{tenantId}/transactions/evaluateThe earn endpoint. Evaluates a basket against all active campaigns — awarding points and/or issuing tangible rewards (coupons, gift cards, free items, discount vouchers) for each match. Members are auto-created on first call — no pre-registration needed. Fully idempotent on transactionRef: safe to retry on network failure.
Idempotent — calling evaluate twice with the same transactionRef returns the original result, never a duplicate award. Safe to retry on network errors.
Path Parameters
Request Body
Response 200
Debug hints
When campaigns is empty on a test key, _debug.campaignChecks tells you exactly why each campaign skipped. Common reasons: CAMPAIGN_NOT_ACTIVE, SEGMENT_MISMATCH, BELOW_MIN_SPEND, DATE_RANGE.
Error Codes
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/transactions/evaluate" \
-H "X-API-Key: sk_test_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"transactionRef": "receipt_001",
"memberRef": "customer_27821234567",
"amount": 15000
}'Response
{
"transactionId": "d2f3a1b4-0e5c-4a8b-9f1d-2c3e4f5a6b7c",
"transactionRef": "receipt_001",
"memberId": "9f4c2e8a-1b2c-3d4e-5f6a-7b8c9d0e1f2a",
"memberCreated": true,
"pointsAwarded": 150,
"pointsBalance": 150,
"campaigns": [
{
"campaignId": "5a7b3c9d-...",
"campaignName": "Spend & Earn",
"pointsEarned": 150,
"rewardIds": []
}
],
"state": "PROCESSED"
}Authenticate to test this endpoint live →