POS Sync: Stock & Order API — Developer Docs

Universal REST API & Webhook bridge for Online Cloud POS and Offline Desktop POS software. Zero customer PII in V1.

Open Live POS DemoMerchant Store Login
GUIDE 1: ONLINE / CLOUD POS SETUP

Real-Time Push + Signed Webhooks

Best for SaaS / cloud POS platforms with a public HTTPS server.

  1. Install & Generate Key: Merchant installs the app in Shopify Admin, opens API Setup & Docs, and clicks Generate API Key (pos_live_...).
  2. Set Webhook URL: Enter your POS server's webhook URL and click Save Settings + Send Test Ping. Copy the generated signing secret.
  3. Map Branches: In Locations & SKU Health, map each POS branch_code (e.g. MAIN, DHAKA-01) to its Shopify Location.
  4. Push Stock in Real Time: On every in-store sale, call POST /api/v1/pos/inventory/adjust with an idempotency_key (e.g. invoice number).
  5. Verify Incoming Orders: When Shopify fires orders/create, orders/cancelled, or refunds/create, verify the X-POSSync-Hmac-Sha256 header (HMAC-SHA256 hex of the raw JSON body using your webhook secret).
// Verify X-POSSync-Hmac-Sha256 (Node.js)
const expected = crypto
  .createHmac("sha256", WEBHOOK_SECRET)
  .update(rawBody, "utf8")
  .digest("hex");
if (req.headers["x-possync-hmac-sha256"] !== expected) return res.sendStatus(401);
GUIDE 2: OFFLINE / LOCAL DESKTOP POS SETUP

No Public URL Needed (Polling + Offline Queue)

Best for Windows .NET, PHP, or shop-counter PCs behind store Wi-Fi.

  1. Install & Copy API Key: Generate the pos_live_... key in Shopify Admin and leave Outbound Webhook URL blank.
  2. Save Branch & Cursor Locally: Store your shop's branch_code and a last_order_sync ISO timestamp locally on the PC.
  3. Queue Offline Sales Safely: If the shop's Wi-Fi drops, save sales locally with their invoice number as idempotency_key. When internet returns, flush them using POST /api/v1/pos/inventory/adjust (relative deltas like -1 never overwrite online sales!).
  4. Poll Online Orders Every 15–30s: Call GET /api/v1/pos/orders?since=<ISO8601> and save next_since from the response. Empty checks (0 orders) are 100% free and do not count against monthly quota.
# Poll new Shopify orders from local PC
GET https://possync.smartposbd.com/api/v1/pos/orders?since=2026-01-01T00:00:00Z
Authorization: Bearer pos_live_xxxxxxxxxxxx

REST API Reference (Base URL: https://possync.smartposbd.com)

All endpoints require Authorization: Bearer <pos_live_api_key> and Content-Type: application/json.

0. POST / GET /api/v1/pos/catalog (Push Local POS Products & Branches)

Push your POS's local product IDs (e.g. 100, 101) and branch codes (e.g. BR-100) so the merchant can link them in Shopify Admin Tab 3. Auto-links matching SKUs/barcodes automatically.

POST /api/v1/pos/catalog
{
  "branches": [{ "branch_code": "BR-100", "name": "Main Shop" }],
  "products": [{ "pos_product_id": "100", "sku": "POS-SKU-100", "title": "Classic T-Shirt" }]
}

1. GET /api/v1/pos/locations

Returns mapped POS branch codes and available active Shopify locations.

2. GET /api/v1/pos/products?page=1&limit=50&search=

Paginates cached Shopify variants (variant_id, sku, barcode, tracked).

3. POST /api/v1/pos/inventory/adjust (Sales & Returns)

Applies relative quantity deltas (-1 for sale, +1 for return) up to 100 items/request. Supports pos_product_id, sku, barcode, or variant_id.

POST /api/v1/pos/inventory/adjust
{
  "idempotency_key": "INV-1042",
  "items": [
    { "sku": "SHIRT-M", "branch_code": "MAIN", "delta": -1 },
    { "pos_product_id": "POS-1042", "branch_code": "DHAKA-01", "delta": -2 }
  ]
}

4. POST /api/v1/pos/inventory/set (Stock Counts)

Sets exact available quantities (up to 100 items/request) and auto-activates items if not yet stocked at that Shopify location.

POST /api/v1/pos/inventory/set
{
  "idempotency_key": "COUNT-2026-01-15",
  "items": [
    { "sku": "SHIRT-M", "branch_code": "MAIN", "qty": 25 }
  ]
}

5. GET / POST / DELETE /api/v1/pos/mappings

Manage custom pos_product_id ↔ Shopify variant mappings programmatically (or via Tab 3 in Shopify Admin).

6. GET /api/v1/pos/orders?since=<ISO8601>&limit=50

Returns sanitized (zero-PII) orders/create, orders/cancelled, and refunds/create events with next_since cursor for offline POS polling.

Product Matching Priority & HTTP Status Codes

Lookup order per item: 1. Custom Mapping (pos_product_id) → 2. Shopify sku (or mapped different POS SKU) → 3. Shopify barcode → 4. variant_id.

  • 200 OK: All items synced (or idempotency replay).
  • 207 Multi-Status: Partial batch success (check succeeded and failed arrays).
  • 401 Unauthorized: Missing or invalid Bearer API key.
  • 409 Conflict: Same idempotency_key reused with a different payload.
  • 429 Too Many Requests: Monthly plan sync limit reached.