Sifr Wahid Developers

Architecture (HLD)

Data conventions

The rules every answer and every body follows, so your mapping is right the first time.

Money

  • Every amount is an integer in halalas: 100 halalas = 1 SAR, so 5000 means SAR 50.00.
  • price: 50 means 50 halalas. 50 SAR is 5000.
  • Amounts are in halalas both ways: in the answers and in your bodies.
  • Exception: amounts inside webhook payloads are in riyals (two decimals), as in the dashboard's webhooks.

Dates and times

  • Dates in the API's answers are ISO 8601 in UTC.
  • updated_since and created_since: ISO 8601, inclusive, whole seconds; no offset means UTC.
  • updated_at has second precision.
  • A webhook envelope's created_at is in the Riyadh offset (+03:00).
  • A key's expiry is the end of that day, Riyadh time.

Translated text

Names and descriptions in two languages are an object {ar, en}, and either side may be null. The ar side holds the Arabic text and en the English text; the examples in these docs show the Arabic side as "...".

JSON
{"name": {"ar": "...", "en": "My store"}}

When you write a product, name.ar is required, and on PATCH the name and description merge per language, so name.ar may be left out.

Ids and SKUs

  • Ids are integers, and each is about the key's store only: an id of another store answers 404 not_found.
  • A variant's SKU is unique in the store, up to 64 characters. It is the link between your system and the store: GET /products/sku/{sku} and PATCH /products/sku/{sku} address a product by it.
  • A customer is one per mobile in a store (409 customer_exists names the existing one).

Lists

  • Lists are ordered by (updated_at, id) and read page by page with meta.next_cursor, which is opaque and null on the last page.
  • per_page 1 to 100 (default 50; more is capped at 100).
  • A deleted row vanishes from the lists and never comes back through updated_since.

Errors

JSON
{ "error": { "code": "validation_failed", "message": "…", "fields": { "variants.0.sku": ["…"] } } }

code is stable for your program, message is for people (Arabic by default; send Accept-Language: en for English), and fields appears only on errors about inputs. See Errors.

Compatibility of version 1

v1 is add-only: new endpoints, new keys in answers, new optional fields. No key is removed, renamed or retyped; ignore keys you do not know.