Winner

Winner till API

Connect a point-of-sale system to Winner so members earn and spend points as part of the normal sale.

How it works

  1. The store owner or a manager creates a key under Store → Till connections and pastes it into the till's settings.
  2. At checkout the till sends the scanned card to /cards/lookup and shows the member's eligible offers.
  3. It calls /purchases/preview with the bill, applies the returned discount, then confirms with /purchases and an Idempotency-Key.
  4. If a sale is voided, the till calls /purchases/{id}/reversal (manager keys only).

Endpoints

MethodPathScope
GET/me—
POST/cards/lookupcards:read
POST/purchases/previewpurchases:write
POST/purchasespurchases:write
GET/purchases/{id}purchases:read
POST/purchases/{id}/reversalreversals:write
GET/ordersorders:read
GET/orders/{id}orders:read
POST/orders/{id}orders:write
GET/bookings?day=bookings:read
GET/bookings/servicesbookings:read
GET/bookings/slots?serviceId=&day=bookings:read
GET/queue?branchId=queue:read
POST/giftcards/lookupgiftcards:read

Base address: https://winnerapp.app/api/pos/v1

Example: confirm a sale

curl -X POST https://winnerapp.app/api/pos/v1/purchases \
  -H "Authorization: Bearer $WINNER_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"cardInput":"<scanned code>","subtotalMinor":2500000,"currency":"SYP",
       "actualDiscountMinor":0,"receiptRef":"T1-000123"}'

For partner companies (one key, many stores)

Till/POS makers, delivery apps and other partners don't need each store to make a key. Once the Winner team sets up your partner account:

  1. Sign in to the partner area (/partner) and make a key (wp_live_… on the live site, wp_test_… on staging). It's shown once.
  2. Send store owners your connect link. They choose the store (and branch) and allow exactly the permissions you ask for.
  3. You get the connection id: back at your return address (?connection=…&state=…) or as a code the store gives you.
  4. Call the same till API with your key and a Winner-Connection header carrying that id. Each connection acts at that store only, as the manager who allowed it.
  5. Stores can disconnect you at any time (calls then answer 401). Limits: 120 calls a minute per store and 1,200 across all your stores.
curl -X POST https://winnerapp.app/api/pos/v1/cards/lookup \
  -H "Authorization: Bearer wp_live_…" \
  -H "Winner-Connection: <connection id>" \
  -H "Content-Type: application/json" \
  -d '{"cardInput":"…"}'

Webhooks: hear about purchases

Add an https address under Store → Till connections → Webhooks. Winner sends a signed POST when a purchase is confirmed, reversed, or held for the Winner team, plus a test event on request.

// Node.js — verify a Winner webhook (use the raw request body, before JSON parsing)
const crypto = require("node:crypto");
function verifyWinner(rawBody, header, secret) {
  const { t, v1 } = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  if (Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
  const want = crypto.createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex");
  return v1.length === want.length && crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(want));
}

Rules

Download the OpenAPI description