Skip to content

Till integration walkthrough

This page walks through a complete till integration using only live endpoints. Each step links to its guide.

  1. Get credentials. The brand gives you a client id and secret. Store the secret like a password. See Authentication.
  2. Map your stores. For each till location, find the LoyX store by your own store code: GET /v1/stores/external/{external_store_id}. If a store has no code yet, set it with PATCH /v1/stores/{store_id} or ask the brand to. See Stores.
  3. Decide your receipt id. Pick an id that is unique per brand for all time, for example {store}-{register}-{number}. See Idempotency.
  1. POST /v1/auth/token with your client id and secret. Cache the token until shortly before expires_in runs out. On any 401, get a new token and retry the call once.
cashier scans app QR ──► lookup ──► card ──► (sale is paid) ──► record sale
│ │
└─ 404: continue without a member ───────┘
  1. Identify. The member shows the QR code in the LoyX app. Send the scanned text, unchanged:

    POST /v1/memberships/lookup
    {"identifier": "qr_code", "value": "<scanned text>"}

    Keep membership_id. On 404 qr_code_not_resolvable, ask the member to refresh the code. On 404 membership_not_found, continue as a guest. See Identify a member.

  2. Show the card (optional). The lookup answer already has the balance, unit and cycle. Add the member’s usable rewards at this store with GET /v1/memberships/{membership_id}/rewards?external_store_id=<your store code>. See Member card and rewards.

  3. Record the sale once it is paid: POST /v1/transactions with your receipt id in external.external_transaction_id, your store code in external.external_store_id, the member as {"identifier": "membership_id", "value": "..."}, and the lines. See Record a sale.

    Send it after the receipt prints, from a local queue. The sale should never wait on LoyX.

Situation Do this
No answer, timeout, 502/503/504 Retry the same request later. The receipt id makes it safe.
429 Wait Retry-After seconds.
401 Get a new token, retry once.
409 external_transaction_id_conflict Two receipts share an id. Fix your id scheme; do not retry.
422 Fix the fields listed in error.details; do not retry unchanged.
The till is offline Queue sales locally, send them when online, in order. Late sales are accepted.
  • Secrets are stored encrypted and never logged.
  • Every sale carries a unique, stable external_transaction_id.
  • A retried sale returns 200 with Idempotent-Replayed: true, not a second sale.
  • QR text is sent unchanged.
  • Amounts are integers in minor units.
  • Sales are sent from a queue that survives a restart.
  • Phone numbers, emails and national ids never appear in URLs or logs.
  • Your client ignores unknown fields and enum values.