☰ Menu · Quickstart
Getting started

Quickstart

Create a test key, check it, enrol a guest and apply a check. Five calls, about five minutes.

  1. 1
    Create a test key

    In the venue dashboard open Developers → API keys, choose Test and the scopes you need. The key is shown once, starting with sk_test_. If you build for many venues, ask each venue to create a key for you, or write to us and we set up a partner account.

  2. 2
    Check the key

    Call GET /v1/account. It returns the venue, its loyalty programs and the scopes of your key. If you get 401, the key is wrong or revoked.

  3. 3
    Enrol a guest

    Call POST /v1/members with a phone, a first name and consent: true. The response has the card number and links to add the card to Apple Wallet or Google Wallet.

  4. 4
    Apply a check

    Call POST /v1/transactions with your own check id in external_id, the card number and the amount. The response shows what the guest earned and the new balance.

  5. 5
    Undo it

    Call POST /v1/transactions/{external_id}/void. The balance goes back to where it was.

1. Check the key

curl
curl https://loyaltyfy.io/api/v1/account \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"
Response · 200
{
  "object": "account",
  "id": "73267e72-7f6e-4ddd-bfa2-bd6746500794",
  "slug": "api-sandbox",
  "name": "API Sandbox",
  "timezone": "Europe/Chisinau",
  "livemode": false,
  "key": { "id": "65b6f90b-ba6f-47ce-886f-2deb9be1f087", "scopes": ["*"] },
  "programs": [
    {
      "id": "06af6eba-eaf5-4662-8a5e-2b6b52c65314",
      "slug": "default",
      "name": "Sandbox Cashback",
      "mechanic": "cashback",
      "currency": "MDL",
      "published": true,
      "barcode": "card_code128",
      "stamps_required": null,
      "cashback_rate": 5
    },
    {
      "id": "1480831a-9331-46dc-b055-90d14c844fb8",
      "slug": "stamps",
      "name": "Sandbox Stamps",
      "mechanic": "stamps",
      "currency": "MDL",
      "published": true,
      "barcode": "card_qr",
      "stamps_required": 5,
      "cashback_rate": null
    }
  ],
  "locations": []
}

Note the programs list: a venue can run several programs (for example cashback for regulars and stamps for coffee). mechanic tells you which numbers matter for a member: cashback, stamps, visit_discount and others.

2. Enrol a guest

curl
curl https://loyaltyfy.io/api/v1/members \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7d1b2c4e-enrol-000123" \
  -d '{
    "phone": "+37366791102",
    "first_name": "Ion",
    "last_name": "Popescu",
    "card_number": "2000111703779",
    "language": "ro",
    "consent": true
  }'
Response · 201
{
  "object": "member",
  "id": "6dacfe0a-2500-44c6-a37c-05c660b093b4",
  "card_number": "2000111703779",
  "serial": "b90273b1-10c9-46eb-ba74-8fef48266b5d",
  "first_name": "Ion",
  "last_name": "Popescu",
  "phone": "+37366791102",
  "email": null,
  "birthday": null,
  "language": "ro",
  "marketing_consent": false,
  "program": {
    "id": "06af6eba-eaf5-4662-8a5e-2b6b52c65314",
    "name": "Sandbox Cashback",
    "mechanic": "cashback",
    "barcode": "card_code128"
  },
  "stamps": null,
  "cashback": {
    "balance": 1250,
    "currency": "MDL",
    "earn_rate": 5,
    "level": null,
    "redeem_max_percent": 30,
    "min_amount": 10000,
    "expires_at": "2027-01-04T18:17:17.721+00:00"
  },
  "discount": null,
  "visits": 1,
  "total_spent": 25000,
  "wallet": {
    "apple_url": "https://loyaltyfy.io/api/wallet/issue/3832466f-...?platform=apple&t=...",
    "google_url": "https://loyaltyfy.io/api/wallet/issue/3832466f-...?platform=google&t=...",
    "card_url": "https://loyaltyfy.io/wallet/3832466f-...?t=..."
  },
  "created_at": "2026-10-06T18:17:15.594+00:00"
}

card_number is optional. Leave it out and we issue a 13-digit number. Send it when the till already has its own cards and the wallet card must carry the same number.

3. Apply a check

curl
curl https://loyaltyfy.io/api/v1/transactions \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "CHK-2026-000123",
    "member": "2000111703779",
    "amount": 25000,
    "currency": "MDL",
    "register_id": "POS-1",
    "closed_at": "2026-10-06T18:17:00+03:00",
    "line_items": [
      { "sku": "1001", "name": "Espresso", "quantity": 2, "unit_price": 4000, "category": "Coffee" },
      { "sku": "2005", "name": "Cheesecake", "quantity": 1, "unit_price": 17000, "category": "Desserts" }
    ]
  }'
Response · 201
{
  "object": "transaction",
  "id": "f8acbb16-0b3b-4afc-acbb-e5eabd4dd072",
  "external_id": "CHK-2026-000123",
  "status": "completed",
  "amount": 25000,
  "redeem_amount": 0,
  "cashback_earned": 1250,
  "stamps_earned": 0,
  "reward_unlocked": false,
  "net_amount": 25000,
  "currency": "MDL",
  "register_id": "POS-1",
  "closed_at": "2026-10-06T15:17:00+00:00",
  "livemode": false,
  "created_at": "2026-10-06T18:17:17.921+00:00",
  "voided_at": null,
  "member": {
    "object": "member",
    "id": "6dacfe0a-2500-44c6-a37c-05c660b093b4",
    "card_number": "2000111703779",
    "cashback": { "balance": 1250, "currency": "MDL", "earn_rate": 5, ... },
    ...
  }
}

4. Undo it

curl
curl -X POST https://loyaltyfy.io/api/v1/transactions/CHK-2026-000123/void \
  -H "Authorization: Bearer sk_test_..."
Everything you do with a sk_test_ key is marked livemode: false. Test members and checks are real rows in the venue's account, so use a test venue or clean up after yourself. See Testing.
Questions about an integration: api@loyaltyfy.io. We answer within one business day.