Quickstart

From zero to your first API call in under 5 minutes.

Step 01

Create your account

Sign up at the merchant portal to receive your test API key and tenant ID.

Step 02

Get your test API key

After signing in, your test key appears in the dashboard. It looks like this:

BASH
sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Test keys start with sk_test_. Live keys start with sk_live_.

Step 03

Create and activate a campaign

A campaign defines what a member earns — points, a tangible reward (coupon, gift card, free item), or both. We'll start with a simple Spend & Earn points campaign, then activate it.

cURL
# Step 1: Create a Spend & Earn campaign (1 point per R1 spent)
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/campaigns" \
  -H "X-API-Key: sk_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name":        "Spend & Earn",
    "earningRule": {
      "type":       "SPEND_PERCENTAGE",
      "percentage": 1
    }
  }'

# Step 2: Activate it (campaigns start in DRAFT state)
curl -X POST "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/campaigns/$CAMPAIGN_ID/activate" \
  -H "X-API-Key: sk_test_YOUR_KEY"

Campaigns must be in ACTIVE state to fire. All ten rule types are in the Campaigns guide.

Step 04

Process a transaction at checkout

Call /evaluate at checkout. The engine awards points and issues any rewards from matching campaigns. Members are auto-created on first call — no pre-registration needed.

cURL
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:
# {
#   "pointsAwarded":  150,
#   "pointsBalance":  150,
#   "memberCreated":  true,
#   "campaigns": [{ "campaignName": "Spend & Earn", "pointsEarned": 150, "rewardIds": [] }]
# }

amount is in cents — R150.00 = 15000. memberRef is your customer's ID. Each campaign returns a rewardIds array — empty here, but populated when a campaign issues a coupon, gift card, or free item. Resolve them via GET /members/:id/rewards.

Step 05

Check your member's balance

Fetch the member to confirm points were awarded and see their full profile.

cURL
curl "https://loyalty-engine-production-e5cb.up.railway.app/v1/tenants/$TENANT_ID/members?ref=customer_27821234567" \
  -H "X-API-Key: sk_test_YOUR_KEY"

What's next?

API Reference →Earn & Burn guide →Campaign rules →Issuing rewards →Webhooks →
Quickstart — Loyalty Engine Docs