🪙 Documentation

Pockard Loyalty API

This is the technical API reference for the Pockard loyalty system — earning and redeeming points, tier configuration, card assignment, OTP protection, reports. Every endpoint comes with a request/response example and a cURL command.

A note on language. The API itself returns its message text in Georgian, and pointsLabel is whatever the company configured. Those values are reproduced verbatim below, with an English gloss in brackets — do not match on the English text.

Getting started

Authorization

Every endpoint (except the two explicitly marked public) requires an Authorization: Bearer {token} header. The token comes from POST /api/auth/login.

curl -X POST https://api.pockard.online/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"login":"salaro_01","password":"MyPassword123"}'

# the response contains token, role, companyId, permissions (bitmask)

The token you receive is then sent with every subsequent request:

curl https://api.pockard.online/api/manager/loyalty/stats \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

API key (for your POS)

A POS, ERP or other system should not sign in with a member of staff's password — when that person leaves or changes it, the integration stops. In the manager web panel, under "Integrations", create an API key (requires the ManageIntegrations permission) and send it in the X-Api-Key header. The key is shown once, at creation; only its hash is stored.

curl -X POST https://api.pockard.online/api/manager/loyalty/transaction \
  -H "X-Api-Key: pk_Vd3...xQ" \
  -H "Content-Type: application/json" \
  -d '{"cardCode":"A1B2C3","cashAmount":45.50,"externalId":"RCPT-000184"}'
A key works only on the /api/manager/loyalty/* endpoints, and only with the permissions it was given (transactions, history, reports, statistics). Operations it posts appear in the history under the key's name. A revoked key gets 401 immediately.

Rate Limiting

The API applies per-IP rate limiting through three policies. Most loyalty endpoints sit in the general policy (60 req/min); /api/manager/card/initiate and the auth endpoints use the auth policy (5 req/min).

PolicyAlgorithmLimit
authFixed Window5 req/min
generalSliding Window60 req/min
general (with an API key)Sliding Window300 req/min per key
429 Too Many Requests — when the limit is exceeded. Use exponential backoff to retry.
Access model

Permissions (bitmask)

Access for company staff (cashier / manager) is controlled by a long bitmask carried in the JWT permissions claim. Bits combine with | — for example a cashier who can run a transaction and view their own history has 32 | 4096 = 4128. The Admin role passes every policy automatically, regardless of the bitmask.

PermissionBitWhat it controls
ManageLoyalty32Running a transaction (POST /transaction), next-code, customer/card lookup, sending an SMS OTP.
ConfigureLoyalty64Editing and voiding transactions, the staff list, and every staff member’s operations in history and reports (without it, only their own).
ViewStats2048Statistics: GET /stats, GET /segments, GET /report/range.
ViewHistory4096Transaction history: GET /transactions.
ViewReports8192Reports: GET /report/daily, GET /report/range, GET /transactions.
ViewOwnHistory128Retired — replaced by ViewHistory and ViewReports.
UseFlatLoyalty256Configuring a Flat loyalty program (/api/loyalty/program).
UseTieredLoyalty512Configuring a Tiered loyalty program and its tiers.
ManageIntegrations32768API keys and webhooks (/api/manager/integrations). A key cannot be given this permission.

Every endpoint in this document carries a Policy badge showing what it requires. User token means the endpoint uses a customer token rather than a manager/staff one. Public means no authorization at all.

Configuration

Program settings

The company’s loyalty program type (Flat or Tiered), cashback percentage, point value, expiry, bonuses, and — for Tiered programs — the list of tiers. Amounts are in the company’s currency; a Pockard admin sets it and the API converts nothing.

GET /api/loyalty/program Policy: UseFlatLoyalty | UseTieredLoyalty

The current loyalty program configuration, tiers included, for the company of the authorized caller (companyId claim).

Request
curl https://api.pockard.online/api/loyalty/program \
  -H "Authorization: Bearer {token}"
Response 200 OK
{
  "id": "p1...",
  "companyId": "f7e8d9c0-...",
  "programType": 1,
  "flatCashbackPercent": 0,
  "isActive": true,
  "pointsLabel": "ქულა",
  "pointValue": 0.01,
  "pointExpiryDays": 365,
  "minEarnAmount": 5,
  "maxEarnPerTransaction": null,
  "minRedemptionPoints": 100,
  "welcomeBonusPoints": 20,
  "birthdayBonusPercent": 10,
  "termsText": null,
  "pointsIcon": null,
  "pointsIconColor": null,
  "tiers": [
    { "id": "t1...", "name": "Silver", "minMonthlySpend": 0, "maxMonthlySpend": 300, "cashbackPercent": 5, "color": "#94A3B8", "sortOrder": 1 }
  ]
}

// programType: 0 = Flat, 1 = Tiered
// 404 Not Found — the program has not been configured yet
PUT /api/loyalty/program Policy: UseFlatLoyalty | UseTieredLoyalty

Creates or updates the company’s loyalty program (upsert). Apart from Admin, a non-admin caller needs the UseFlatLoyalty bit to configure a Flat program, or UseTieredLoyalty for a Tiered one.

Request Body
// Content-Type: application/json
{
  "programType": 1,
  "flatCashbackPercent": 0,
  "isActive": true,
  "pointsLabel": "ქულა",
  "pointValue": 0.01,
  "pointExpiryDays": 365,
  "minEarnAmount": 5,
  "maxEarnPerTransaction": null,
  "minRedemptionPoints": 100,
  "welcomeBonusPoints": 20,
  "birthdayBonusPercent": 10,
  "termsText": null,
  "pointsIcon": null,
  "pointsIconColor": null
}
Response
// 200 OK — the updated LoyaltyProgramDto
// 403 Forbidden — the non-admin caller lacks the matching UseFlat/UseTiered bit
POST /api/loyalty/program/tiers Policy: UseFlatLoyalty | UseTieredLoyalty

Adds a new tier (only relevant for Tiered programs).

Request Body
{
  "name": "Gold",
  "minMonthlySpend": 300,
  "maxMonthlySpend": null,
  "cashbackPercent": 12,
  "color": "#F59E0B",
  "sortOrder": 2
}
Response
// 201 Created — LoyaltyTierDto
// 400 Bad Request — e.g. the spend ranges overlap
PUT /api/loyalty/program/tiers/{tierId} Policy: UseFlatLoyalty | UseTieredLoyalty
Request body — the same fields as POST tiers. Response: 200 OK + LoyaltyTierDto, or 400 Bad Request.
DELETE /api/loyalty/program/tiers/{tierId} Policy: UseFlatLoyalty | UseTieredLoyalty
Response: 204 No Content, or 400 Bad Request (e.g. trying to delete the last remaining tier).
Integration

Sale flow

Redeeming and earning sit on opposite sides of the payment, and the order follows from what each failure costs: deducting points and then failing the payment takes money from the customer, while awarding points on a failed sale takes it from the business. So redeem before payment (so it can still be voided) and earn after payment.

1. Scan the card      → GET /api/manager/loyalty/card/{code}
2. Paying with points? → OTP: barcode in the app, or SMS
3. Redeem              → POST /transaction  { pointsToRedeem, redemptionOtp, cashAmount: 0 }
4. Take payment        → your POS
     failed            → POST /operations/{operationId}/void
5. Earn                → POST /transaction  { cashAmount: what was actually paid }
Points are earned on the amount paid, not on the basket value. A 100 GEL basket settled with 20 GEL of points and 80 GEL cash means cashAmount: 80.
Two requests the server refuses (400):
  • A negative cashAmount — it means the points were worth more than the basket. Your subtraction must never fall below zero: offer the customer fewer points instead. 0 is fine — the points covered the price exactly.
  • No points rate set — if the company has not entered what one point is worth, pointsToRedeem is refused. The rate lives in the web panel, under the loyalty programme settings.
One call also works. cashAmount and pointsToRedeem can travel in the same request — then the redemption and the earning are one operation, with one operationId and one externalId. Our own till works this way: a cashier is standing there and sees a failed payment at once. The two-step flow above is what you need when your own system takes the payment and failure is a real risk.
If our API is unreachable, the sale must not stop: queue step 5 on your side and send it later — which is exactly why externalId is required. Step 3 cannot happen without us; in that case do not offer payment by points.
Integration

Idempotency

When POST /transaction times out you cannot tell whether it went through. Retrying awards the points twice; not retrying leaves them unawarded. externalId — your receipt number — removes that choice.

  • Unique per company; required for API clients.
  • A second request with the same value returns the original result (200 OK) and creates no new transaction.
  • On a retry you must send the same value. A new value is a new sale.
If you split one sale into two calls, each needs its own externalId. The sale flow sends the redemption and the earning separately, and to the server those are two independent requests. Send the same value for both and the second call is treated as a retry and silently does nothing — you get the first result back. Prefix the receipt number: R-100045 for the redemption, E-100045 for the earning. Send both in one request and one receipt number is all you need.
The response carries operationId. One call writes several rows (redemption, earning, welcome bonus), so no single transaction id would identify the sale — store the operationId to void it later.
Integration

Syncing changes

One question decides whether you need this: do you store our transactions in your own database as well?

No — the till posts and forgets You do not need it. The data lives only with us; there is nothing to reconcile.
Yes — accounting, reports, your own analytics You need it. Otherwise the two databases drift apart.

Why filtering by date is not enough

A manager can void or correct a transaction later — the next day, even. When that happens createdAt does not change: it stays on the day the sale was made.

Monday 14:00   sale — you receive it and store it
Tuesday 10:00  the manager voids that sale
Tuesday 10:05  ?from=Tuesday → this row does not come back
               (createdAt is still Monday)
               your database still counts the points as awarded

changedSince follows the moment of change rather than creation, so that void reaches you.

How to use it

curl https://api.pockard.online/api/manager/loyalty/transactions?changedSince=2026-09-11T08:00:00Z \
  -H "Authorization: Bearer {token}"
  • 1. Call every 1–5 minutes with the timestamp you stored. There is no need to poll faster — most of the time the answer is empty.
  • 2. Process what comes back. isVoided, voidedAt and editedAt tell you what changed.
  • 3. Remember the highest updatedAt you saw and store it in your database — kept in memory it is lost on restart.
  • 4. Send exactly that value next time.
The last row arrives again. That is deliberate — two rows can share a timestamp, and a strictly-greater comparison would skip one of them for good. Filter out what you already hold by id.
The first call: send the company's start date to pull the whole history, or the current time to receive only future changes.
Catching up after a long gap: results are paged (100 rows at most). Always ask for page=1, process it, move the cursor forward and repeat until the answer is empty. Moving to page=2 risks missing a row if the data changes between requests.
Integration

Webhooks

Instead of polling (changedSince), let Pockard send events to your https address. Add a webhook in the manager web panel under "Integrations" and pick the events. An event is queued in the same database transaction that saved the change — a change that was saved always reaches you, and one that failed never does.

EventWhen
operation.createdA sale, redemption or visit was posted (one POST /transaction).
operation.voidedA whole operation was reversed.
transaction.editedA manager corrected one row of an operation.
transaction.voidedOne row of an operation was reversed.
reward.grantedA visit filled the visit card — the customer is owed a prize.
fraud.alertA fraud rule flagged something.
POST https://erp.example.com/pockard
Pockard-Event: operation.created
Pockard-Event-Id: 3f0c...
Pockard-Signature: t=1790000000,v1=5d41402abc4b2a76b9719d911017c592...

{
  "id": "3f0c...",
  "type": "operation.created",
  "createdAt": "2026-09-26T10:14:03Z",
  "companyId": "...",
  "data": { "operationId": "...", "externalId": "RCPT-000184", "cardCode": "A1B2C3",
            "cashAmount": 45.5, "pointsEarned": 4.55, "balanceAfter": 120.3, ... }
}

Verifying the signature

v1 is HMAC-SHA256 with the webhook's secret (whsec_...) over {t}.{body} — exactly the bytes you received. Reject the request if the signature does not match or t is more than 5 minutes old.

// C#
var expected = Convert.ToHexString(HMACSHA256.HashData(
    Encoding.UTF8.GetBytes(secret), Encoding.UTF8.GetBytes($"{t}.{rawBody}"))).ToLowerInvariant();
var ok = CryptographicOperations.FixedTimeEquals(
    Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(v1));
2xx means "received". On any other answer, or none within 10 seconds, Pockard retries after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h — 8 attempts in all. The same event can arrive twice; de-duplicate on id. Order is not guaranteed.
Integration

Visit rewards

Every N visits the customer earns a prize. It runs alongside cashback, and POST /transaction needs no change — the server counts the visit itself.

What counts as a visit

  • The basket = cashAmount + the value the points covered. It must be at least minVisitAmount.
  • One visit per card every visitCooldownHours hours (24 by default).
  • A purchase paid entirely with points counts only when countPointsOnlyVisit is on.
  • A void takes the visit back — and the prize too, if it has not been used yet.
  • A visit with no amount — leave cashAmount and pointsToRedeem empty.

Transaction response

{
  "operationId": "9b1e…",
  "pointsEarned": 8.00,
  "visitCount": 0,
  "visitsRequired": 10,
  "rewardGrantId": "3f2a…"
}

rewardGrantId is returned when this sale fills the card, so the till can tell the customer on the spot. If the company runs no visit rewards, all three fields are null.

Prize modes

  • Fixed — the highest-placed active prize is handed over the moment the card fills.
  • Wheel — the customer spins in the app. The server picks the prize by weight; prizes that are out of stock or expired take no part in the draw.
A prize is a voucher: it lands in the customer's voucher list, and the cashier redeems it like any other voucher. Prize vouchers are created separately, under the visit-rewards permission — the vouchers permission is not needed. They stay out of the public voucher list and cannot be claimed there, and transferLocked: true stops a won voucher from being passed on.

Configuration

GET /api/loyalty/program/rewardsPrizes, with their current chance (chancePercent)
POST /api/loyalty/program/rewardsAdd — ticketId, weight, stock, label, color
PUT /api/loyalty/program/rewards/{id}Edit. Stock cannot go below what has already been given out.
DELETE /api/loyalty/program/rewards/{id}Deleted — or deactivated, if someone has already won it
GET /api/loyalty/program/rewards/vouchersPrize vouchers
POST /api/loyalty/program/rewards/vouchersCreate — title, description, maxClaims, validFrom, validTo, transferLocked, isActive
PUT /api/loyalty/program/rewards/vouchers/{id}Edit — the same fields
DELETE /api/loyalty/program/rewards/vouchers/{id}Deleted if nobody has won it and it is not on the prize list; otherwise 400 — switch it off with isActive: false

Points switched off

A company can keep visit rewards on their own. Once points are switched off:

  • A transaction with an amount is still recorded, but earns no points (pointsEarned: 0).
  • Remaining points can be spent as usual until the write-off date (7, 14 or 30 days).
  • After the write-off, a request with pointsToRedeem is refused (400).
When saving the programme, visit settings change only if the request includes visitRewardEnabled. A save without that field leaves the visit card untouched.
Methods

Transactions

Earning and redeeming points at the till, editing or voiding them afterwards, and reading the history.

POST /api/manager/loyalty/transaction Policy: ManageLoyalty

A unified transaction — it can earn points (cashAmount) and/or redeem them (pointsToRedeem) in one call. When points are redeemed, redemptionOtp is required (see Redemption OTP). One call is one operation — one operationId, one void.

Request Body
// earning points
{
  "cardCode": "001-000042",
  "cashAmount": 80.00,
  "pointsToRedeem": null,
  "note": "Groceries",
  "redemptionOtp": null,
  "items": null,
  "externalId": "E-100045"
}

// redeeming points (OTP required)
{
  "cardCode": "001-000042",
  "cashAmount": null,
  "pointsToRedeem": 50,
  "note": null,
  "redemptionOtp": "3842",
  "items": null,
  "externalId": "R-100045"
}

// mixed payment — one call, one operationId
{
  "cardCode": "001-000042",
  "cashAmount": 80.00,
  "pointsToRedeem": 20,
  "note": null,
  "redemptionOtp": "3842",
  "items": null,
  "externalId": "100045"
}
cardCode*stringThe QR or barcode value.
cashAmountdecimal?Cash actually taken, in GEL — with the part the points covered already subtracted. Cannot be negative.
pointsToRedeemdecimal?Points to redeem.
redemptionOtpstring?4-digit code, required when pointsToRedeem > 0.
notestring?Free-text note.
itemsarray?Optional — the purchase line items (name/code/qty/unitPrice).
externalId*string?Your receipt number. Required from the API — see externalId.
locationIdguid?The branch where the sale happened. Not needed when the member of staff or the API key is tied to a branch — naming a different one then returns 400. List: GET /api/manager/locations.
locationCodestring?The same, by the branch's short code (e.g. VAKE).
voucherIdguid?The customer's voucher redeemed with this purchase — the value of its QR code. It must belong to the cardholder and to your company. With a discount voucher, cashAmount is the sum before the voucher; the server works the discount out on the full price (cashAmount plus what the points covered) and takes it off cashAmount. Points earn on what is left to pay. See voucher-quote.
Response 200 OK
{
  "operationId": "9f1c…",
  "pointsRedeemed": 0,
  "pointsEarned": 8,
  "balanceAfter": 328,
  "tierName": "Silver",
  "tierColor": "#94A3B8",
  "cashbackPercent": 10,
  "pointValue": 0.01
}
A push notification is sent to the cardholder automatically after every transaction.
With voucherId the answer also carries voucherId, voucherDiscount (what it took off; 0 for a plain gift voucher) and amountToPay — what the customer pays. The voucher is spent in the same operation; voiding the operation gives it back to the customer.
400 Bad Request — "შეიყვანეთ თანხა, ქულები, ან ორივე." (enter an amount, points, or both) · "არასაკმარისი ქულები. ხელმისაწვდომია: 80." (not enough points; available: 80) · "ქულების გამოყენებისთვის საჭიროა OTP კოდი." (redeeming points requires an OTP code) · "OTP კოდი არასწორია ან ვადა გასულია." (the OTP code is wrong or has expired) · with a voucher: "ვაუჩერი ამ ბარათის მფლობელს არ ეკუთვნის." (the voucher is not this cardholder's) · "უკვე გამოყენებულია…" (already used) · "ვაუჩერი მოქმედებს 30 ₾-დან…" (below the voucher's minimum purchase) · "ქულები და ვაუჩერი ერთად ფასზე მეტს ფარავს — ქულები შეამცირეთ." (points and the voucher together cover more than the price)
POST /api/manager/loyalty/voucher-quote Policy: ManageLoyalty

What a voucher takes off — without spending anything. The POS asks first, reduces the receipt, then sends POST /transaction with the same voucherId and the same amount — the answer carries the same discount. A voucher that cannot be used is not an error: canRedeem: false with the reason in problem, to show the cashier.

Request Body
{
  "voucherId": "3b6e…",
  "amount": 40.00,
  "cardCode": "A1B2C3"
}
voucherId*guidThe value of the voucher's QR code.
amount*decimalThe full price — before the voucher and before any points.
cardCodestring?The card the purchase goes on. When given, the voucher must be its holder's.
Response 200 OK
{
  "voucherId": "3b6e…",
  "title": "-15% on your next visit",
  "canRedeem": true,
  "problem": null,
  "discount": 6.00,
  "amountToPay": 34.00,
  "terms": { "percent": 15, "amount": null, "maxAmount": 10, "minPurchase": null },
  "currency": "₾"
}
terms: null — a plain gift voucher (discount: 0). 404 — no such voucher, or it is another company's.
POST /api/manager/loyalty/operations/{operationId}/void Policy: ManageLoyalty

Voiding a sale. Reverses the whole operation: every row, the points, the recorded spend and the tier together. Voiding one row on its own leaves the balance wrong. A voucher redeemed with the purchase goes back to the customer.

ConfigureLoyalty / Adminany operation, at any time
ManageLoyalty (cashier)their own only, within 5 minutes
400 — already voided · belongs to someone else · the 5 minutes have passed.
PUT /api/manager/loyalty/transactions/{transactionId} Policy: ConfigureLoyalty

Edits an existing transaction (amount, points, note). Stores editedAt and editedByUsername for the audit trail.

Request Body
{
  "amount": 75.00,
  "pointsToRedeem": null,
  "note": "Corrected: the original was wrong"
}
Response
// 200 OK — the updated LoyaltyTransactionDto
// 400 Bad Request — validation, or an attempt to edit a voided transaction
POST /api/manager/loyalty/transactions/{transactionId}/void Policy: ConfigureLoyalty

Voids a transaction — its effect on the balance is reversed, while the record itself stays in the history with isVoided=true (soft void).

curl -X POST https://api.pockard.online/api/manager/loyalty/transactions/{transactionId}/void \
  -H "Authorization: Bearer {token}"

// 200 OK { "message": "Transaction voided." }
// 400 Bad Request — the transaction is already voided
GET /api/manager/loyalty/transactions Policy: ViewHistory | ViewReports

A ConfigureLoyalty or Admin caller sees every transaction in the company; anyone else sees only their own (createdByUsername is taken from the token automatically).

Query Params
pageintdefault 1
pageSizeintdefault 20, max 100
changedSincedatetime?Change cursor — see changedSince. Ordered oldest first.
cardCodestring?Filter by card code
transactionTypestring?Earn / Redeem
usernamestring?The cardholder’s username
notestring?Search within the note
createdByUsernamestring?Only ConfigureLoyalty/Admin may specify someone else
from / todatetime?Date range
Response 200 OK
[
  {
    "id": "tx1...",
    "userId": "u1...",
    "username": "giorgi_k",
    "phoneNumber": "+995599123456",
    "cardCode": "001-000042",
    "transactionType": "Earn",
    "amount": 80.00,
    "pointsChanged": 8,
    "balanceAfter": 328,
    "note": null,
    "createdByUsername": "salaro_01",
    "createdAt": "2026-07-18T10:00:00Z",
    "isVoided": false,
    "voidedAt": null,
    "editedAt": null,
    "editedByUsername": null
  }
]
Card assignment

Issuing a new loyalty card

A three-step, OTP-based flow — the card is added straight into the customer’s Pockard wallet.

GET /api/manager/loyalty/cards/next-code Policy: ManageLoyalty

Generates the next sequential card code with the company prefix (001-XXXXXX).

Request
curl https://api.pockard.online/api/manager/loyalty/cards/next-code \
  -H "Authorization: Bearer {token}"
Response 200 OK
{ "code": "001-000043" }
POST /api/manager/card/initiate Authenticated staff

Sends an OTP to the customer by SMS to confirm the card assignment. Governed by the auth rate-limit policy (5/min).

Request Body
{
  "phoneNumber": "+995599123456",
  "cardCode": "001-000043",
  "cardType": "Qr"
}
// cardType: "Qr" or "Barcode"
Response 200 OK
{
  "message": "OTP sent to the user's phone number.",
  "expiresAtUtc": "2026-07-18T14:25:00Z"
}

// 400 Bad Request
{ "message": "ამ ტელეფონის ნომრის მომხმარებელი ვერ მოიძებნა." }   // no user with that phone number
{ "message": "ამ კოდის ბარათი უკვე არსებობს ამ კომპანიისთვის." }  // a card with that code already exists for this company
POST /api/manager/card/confirm Authenticated staff

Verifies the OTP and creates the card in the customer’s wallet.

Request Body
{
  "phoneNumber": "+995599123456",
  "otp": "7842"
}
Response 200 OK
{ "message": "ბარათი წარმატებით გადაეცა მომხმარებელს." }  // the card was handed over successfully

// 400 Bad Request
{ "message": "OTP კოდი არასწორია ან ვადა გასულია." }   // the OTP code is wrong or has expired
Security

Redemption OTP

Redeeming points (pointsToRedeem > 0) always requires a 4-digit, 3-minute OTP from the card’s original owner — by two routes: the app (Flow 1) or SMS (Flow 2, the offline fallback).

POST /api/loyalty/redemption/initiate User token

Flow 1 — the customer, not the cashier, calls this endpoint from the Pockard app. The server generates an OTP; the app shows it in large type alongside a barcode, and the cashier simply scans it.

Request Body
// Authorization: Bearer {userToken}
{ "cardId": "a1b2c3d4-0000-0000-0000-000000000042" }
Response 200 OK
{
  "otpCode": "3842",
  "expiresAtUtc": "2026-07-18T14:25:00Z"
}
A new request automatically invalidates the previous OTP. The holder of a shared card cannot generate an OTP — only the original owner can.
POST /api/manager/loyalty/redemption/sms Policy: ManageLoyalty

Flow 2 — the cashier requests an OTP by SMS (the customer has no internet). The server finds the card’s original owner by card code and sends the SMS.

Request Body
{ "cardCode": "001-000042" }
Response 200 OK
{ "message": "OTP კოდი გაიგზავნა SMS-ით." }  // the OTP code was sent by SMS

// 400 Bad Request
{ "message": "ბარათის მფლობელს ტელეფონის ნომერი არ აქვს რეგისტრირებული." }   // the cardholder has no registered phone number
Lookup

Customer and card lookup

GET /api/manager/loyalty/lookup Policy: ManageLoyalty

The till’s single search box: q is tried as a card code first, then as a phone number (5XX XXX XXX, 995…, +995…). Either way it returns the card, so the operation is posted with its cardCode.

curl "https://api.pockard.online/api/manager/loyalty/lookup?q=599123456" \
  -H "Authorization: Bearer {token}"
// 200 — the same body as /balance/card/{cardCode}; 404 — "კლიენტი ვერ მოიძებნა." (customer not found)
GET /api/manager/loyalty/customer Policy: ManageLoyalty

Finds the customer’s card for this company by phone number — a fast transaction without scanning a card.

Request
curl "https://api.pockard.online/api/manager/loyalty/customer?phone=%2B995599123456" \
  -H "Authorization: Bearer {token}"
Response 200 OK
{
  "cardCode": "001-000042",
  "username": "giorgi_k",
  "phoneNumber": "+995599123456",
  "points": 328,
  "currentTierName": "Silver",
  "currentTierColor": "#94A3B8",
  "currentCashbackPercent": 10
}
// 404 Not Found — "No loyalty account found for this phone number."
GET /api/manager/loyalty/balance/card/{cardCode} Authenticated staff

After scanning a card, shows the owner’s name and current balance straight away.

{
  "cardCode": "001-000042",
  "ownerUsername": "giorgi_k",
  "ownerPhone": "+995599123456",
  "points": 328
}
// 404 Not Found — "ბარათი ვერ მოიძებნა." (the card was not found)
GET /api/manager/loyalty/users Policy: ConfigureLoyalty

The list of the company’s loyalty staff usernames — useful for the createdByUsername filter dropdown in reports.

["salaro_01", "salaro_02", "manager_1"]
Analytics

Reports and statistics

GET /api/manager/loyalty/report/daily Policy: ViewReports

The totals for one staff member on one day. Non-privileged staff do not need createdByUsername (their own username is used automatically); for ConfigureLoyalty and Admin it is required.

Query Params
date*dateYYYY-MM-DD
createdByUsernamestring?Required for ConfigureLoyalty/Admin
Response 200 OK
{
  "date": "2026-07-18",
  "createdByUsername": "salaro_01",
  "totalTransactions": 24,
  "earnCount": 18,
  "earnTotalAmount": 960.00,
  "earnTotalPoints": 96,
  "redeemCount": 6,
  "redeemTotalPoints": 210,
  "uniqueCards": 21,
  "uniqueUsers": 21,
  "transactions": [ /* LoyaltyTransactionDto[] */ ]
}
GET /api/manager/loyalty/report/range Policy: ViewReports | ViewStats

A date-range report with a daily breakdown. The maximum range is one year.

Query Params
from*dateYYYY-MM-DD
to*date≤ 366 days from from
createdByUsernamestring?For ConfigureLoyalty/Admin — empty means everyone
400 — "End date must be on or after start date." or "Date range cannot exceed 1 year."
Response 200 OK
{
  "dateFrom": "2026-07-01",
  "dateTo": "2026-07-31",
  "createdByUsername": "",
  "totalTransactions": 540,
  "earnCount": 410,
  "earnTotalAmount": 21400.00,
  "earnTotalPoints": 2140,
  "redeemCount": 130,
  "redeemTotalPoints": 4800,
  "uniqueCards": 312,
  "uniqueUsers": 312,
  "dailyBreakdown": [
    { "date": "2026-07-01", "earnCount": 14, "earnTotalAmount": 700, "earnTotalPoints": 70, "redeemCount": 4, "redeemTotalPoints": 150 }
  ]
}
GET /api/manager/loyalty/stats Policy: ViewStats

An overall overview of the company’s loyalty program — requires ViewStats (as does GET /segments).

{
  "totalCards": 312,
  "totalPointsIssued": 18400,
  "totalPointsRedeemed": 6200,
  "totalSpendRecorded": 92400.00,
  "transactionsThisMonth": 540,
  "pointsIssuedThisMonth": 2140
}
Mobile App

User endpoints

These endpoints are used by the Pockard app — the card must always belong to the caller, otherwise 404 is returned.

GET /api/loyalty/balance/{cardId} User token
{
  "cardId": "a1b2c3d4-...",
  "companyId": "f7e8d9c0-...",
  "companyName": "Coffee House",
  "points": 328,
  "monthlySpend": 210.00,
  "totalSpend": 1840.00,
  "currentTierName": "Silver",
  "currentTierColor": "#94A3B8",
  "currentCashbackPercent": 10,
  "nextTierMinSpend": 300,
  "nextTierName": "Gold",
  "pointsLabel": "ქულა",
  "pointValue": 0.01,
  "programType": "Tiered",
  "pointsIcon": null,
  "pointsIconColor": null
}
GET /api/loyalty/history/{cardId} User token
Query: page (default 1), pageSize (default 20). Response — LoyaltyTransactionDto[], the same shape as in List transactions.
GET /api/loyalty/program/{companyId} Authenticated (any)

The company’s public loyalty information, for the card detail screen. If no program exists or isActive=false, returns 404.

Response — the same LoyaltyProgramDto as in GET /api/loyalty/program.
Appendix

Error format

Every 4xx response comes back in the same shape: { "message": "..." }. The message text itself is in Georgian.

StatusMeaning
200 / 201 / 204The request succeeded.
400Validation error (see message) — e.g. not enough points, a wrong OTP, an invalid date range.
401The token is missing or has expired.
403The token is valid, but you lack the required permission or policy.
404The resource (card, transaction, program) was not found, or belongs to someone else.
429The rate limit has been exceeded.