Integration model
Loyal Guru is API-first: any system with HTTPS access and a pair of credentials can call it. That makes the technical integration easy β and it makes the architectural decision easy to skip.
The decision is this: does every channel call Loyal Guru directly, or does the traffic pass through a mediation layer you control? Both work. What separates them is who absorbs change, and who is left holding the retries when something fails mid-sale.
This page covers that choice, how to split flows across synchronous, asynchronous, batch and event channels, and what obligations each option creates. It is written for architects and integration leads planning the connection. The module guides cover the calls themselves.
Where the integration logic livesβ
Everything on the Loyal Guru side is a single API β https://streaming.loyal.guru, authenticated with X-Api-Key, X-Api-Secret and X-Api-Version. What changes between the two models is everything to the left of it: whether each system carries its own copy of the integration logic, or whether that logic lives in one place.
Direct or mediatedβ
| Direct calls from each channel | Mediated through a gateway and middleware | |
|---|---|---|
| Credentials | Distributed across every system, and often every terminal | Held once in the mediation layer |
| Contract changes | Every consumer is redeployed | Absorbed in one place; consumers keep their contract |
| Retries and queues | Each system implements its own, or does without | Centralised, with a dead-letter queue for what cannot be delivered |
| Idempotency keys | Generated and persisted per system | Generated and persisted once, at a layer that survives a terminal restart |
| Rate limits | Each channel consumes the quota blindly | Shaped and prioritised across channels |
| Traceability | Fragmented across system logs | One correlation ID across the whole flow |
| Added latency | None | One extra hop |
The trade-off is explicit: mediation costs you a hop and buys you every other row.
Why mediation is the default recommendationβ
In a retail estate, the POS is the most expensive and slowest system to change. It is deployed across hundreds of stores, its release windows are narrow, and its vendor may not be you.
When the integration logic lives inside the POS, every schema change, every new field and every retry policy becomes a store-wide deployment. When it lives in middleware, the POS keeps calling the same internal contract and the change stops at the mediation layer.
The same reasoning applies to credentials. A key distributed to every terminal is a key you cannot rotate quickly.
When a direct call is the right callβ
There is a bounded exception, and it is worth stating precisely because it is often stretched too far.
A direct call is justified when the extra hop would be perceptible to the customer standing at the checkout β typically reading customer data and simulating a cart, where the result is needed before the cashier can continue. Latency there is a business cost, not an architectural preference.
What is not exempt is everything downstream of that. If the confirmation of a cart is sent directly from the POS, the obligations do not disappear β they move to the POS:
- generating and persisting the idempotency key so a retry after a timeout is safe
- holding a local queue for confirmations that could not be delivered
- retrying with back-off, and escalating what never succeeds
- compensating when a sale is later cancelled or returned
That is a real amount of engineering to put inside a POS application. Most projects that start with "the POS will call directly, it is simpler" end up rebuilding exactly this list, one incident at a time.
The practical outcome is usually hybrid: latency-bound reads and simulations go direct; anything that must persist goes through the mediation layer.
Splitting the flowsβ
The question that decides which channel a flow belongs to is not technical. It is operational: does the cashier wait for it?
| Channel | Use it when | Does it block the sale? | Typical flows |
|---|---|---|---|
| Synchronous request/response | The answer is needed to continue | Yes | Identify the Customer, simulate a cart, validate a voucher |
| Asynchronous (queue and worker) | The result must persist, but nobody is waiting for it | No | Confirming a cart after payment, deferred effects |
| Batch files | Volume matters more than immediacy | No | Product catalog, stores, taxonomies, initial customer loads |
| Webhooks | Loyal Guru has something to tell your systems | No | Loyalty events pushed to a CDP, CRM or marketing automation |
Two consequences follow from that table.
Anything in the "yes" column needs a fallback. A synchronous call on the critical path of a sale is a dependency of that sale. If it cannot answer, the sale still has to complete. Reliability covers how to build that.
Simulating and confirming are different problems. The simulation is what the cashier sees and therefore has to be fast. The confirmation is what has to be true afterwards and therefore has to be durable. Designing both as one blocking synchronous call inherits the worst property of each.
What the mediation layer ownsβ
If you do put a mediation layer in place, these are the responsibilities that belong there rather than in each channel:
| Responsibility | What it means in practice |
|---|---|
| Credential custody | One set of keys per environment, rotatable without touching the stores |
| Contract translation | Channels keep their internal formats; the layer maps them to the API |
| Idempotency keys | Generated at the origin of the operation and persisted, so a retry carries the same key |
| Retries and back-off | One policy, applied consistently, honouring Retry-After |
| Queue and dead-letter queue | Nothing is lost silently; what cannot be delivered is visible and replayable |
| Rate shaping | Batch traffic does not consume the quota that checkout needs |
| Correlation IDs | One identifier spanning channel, middleware and API, so an incident can be traced end to end |
| Degraded-mode policy | Decided once, applied everywhere, instead of improvised per channel |
Non-functional baselineβ
These apply regardless of which model you choose:
| Item | Baseline |
|---|---|
| Transport | HTTPS to https://streaming.loyal.guru |
| Authentication | X-Api-Key, X-Api-Secret and X-Api-Version headers |
| Rate limits | Tier 1 (critical) 60 requests/second Β· Tier 2 (moderate) 25 Β· Tier 3 (low) 10 |
| Exceeding the limit | HTTP 429 Too Many Requests with a Retry-After header |
| Server errors | Back off from 1 second, increasing exponentially up to 32 seconds |
| Environments | Separate credentials per environment; never test against production data |
Cart evaluation endpoints β POST /carts/realtime and POST /carts/simulate β are Tier 1. For global caps, burst limits and monthly usage, check your service agreement or contact your account manager.
Before you buildβ
Every flow you are going to implement should be written down before it is coded: which system starts it, whether it blocks the sale, what happens when it fails, and who owns it. The Flow mapping template gives you the fields to fill in, and the Integration checklist places that exercise in the implementation sequence.
Related API Referenceβ
- API Reference β endpoint catalog and schemas
- HTTP behavior β authentication, idempotency, rate limits and error format
Troubleshootingβ
| Symptom | Likely cause | What to check |
|---|---|---|
429 under normal load | Batch and checkout traffic share the same quota | Separate the credentials or shape the batch traffic in the mediation layer |
| Duplicate effects after a network glitch | The retry did not carry the original idempotency key | The key must be generated where the operation starts, not where the request is sent |
| A key rotation requires a store deployment | Credentials live in the terminals | Move credential custody to the mediation layer |
| Incidents that cannot be traced past the middleware | No correlation ID propagated | Attach one at the channel and carry it through every hop |