Build an app

Stokzone apps access merchant data via OAuth 2.1. This guide covers every step from creating an app to publishing it.

End-to-end flow

You create your app in the panel, get its credentials, submit for review, and publish on apps.stokzone.com once approved.

  1. Developer account and appCreate your developer organisation and app in the panel (app.stokzone.com/{locale}/dashboard/developer).
  2. Client ID and secretA client_id (prefix szapp_) and client_secret (prefix szcs_) are generated. The secret is shown ONCE; you can rotate it, and rotation invalidates the old one immediately (no grace).
  3. Install URL and redirect URIsDefine your Install URL and redirect URIs. redirect_uri must match EXACTLY (no prefix/wildcard), https is required; http is only accepted for localhost/127.0.0.1 loopback, and fragments (#) are forbidden.
  4. ScopesRequest the scopes your app needs, with justification. Broad legacy 'read'/'write' scopes are not granted; only granular scopes are used.
  5. Mandatory webhooksFor GDPR/KVKK you must subscribe to app.uninstalled, customer.data_request, customer.redact and shop.redact.
  6. Store listingUpload TR and EN listing copy, an icon and screenshots (limits below).
  7. Submit for reviewSubmit the version for review: automated checks first, then a human review by the Stokzone team. On rejection you get a reason, fix it and resubmit.
  8. PublishOnce approved the app becomes 'published' and goes live on apps.stokzone.com. Until a new version is approved, the storefront shows the previous active version.

OAuth 2.1 endpoints

All endpoints are under /api/v1. The consent screen lives at app.stokzone.com/oauth/authorize; the token and revoke endpoints are on api.stokzone.com.

EndpointPurpose
GET /oauth/authorizeValidates the authorization request; the panel renders the consent screen (tenant selection + scopes).
POST /oauth/tokenauthorization_code → access + refresh token; the refresh token rotates on every use.
POST /oauth/revokeToken revocation (RFC 7009). Revoking a refresh token drops the whole family.
GET /oauth/metadataAuthorization server metadata (RFC 8414): endpoints, S256, iss support.
GET /app-api/v1/installationReturns the installation and effective scopes for a Bearer access token (connection test).

PKCE (S256) required

PKCE is mandatory and only S256 is accepted ('plain' is rejected). You send the user to the consent screen with these parameters. ⚠️ We cannot link straight to /oauth/authorize: the code_challenge (and code_verifier) must be generated by your app (RFC 7636).

Authorization request
https://app.stokzone.com/oauth/authorize
  ?response_type=code
  &client_id=szapp_xxxxxxxxxxxx
  &redirect_uri=https://app.example.com/oauth/callback
  &scope=orders:read%20shipping:write
  &state=<rastgele>
  &code_challenge=<BASE64URL(SHA256(verifier))>
  &code_challenge_method=S256

After the user approves, a single-use code is returned to your redirect_uri. Exchange it with the code_verifier and your client secret (client_secret_basic or client_secret_post):

POST /oauth/token
POST https://api.stokzone.com/api/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
Authorization: Basic base64(client_id:client_secret)

grant_type=authorization_code
&code=szac_...
&redirect_uri=https://app.example.com/oauth/callback
&code_verifier=<43-128 karakter>

Every redirect (success and error) includes the RFC 9207 iss parameter; the client must compare it against the expected issuer.

Token lifetimes and prefixes

TokenPrefixLifetime
Authorization codeszac_10 minutes (single-use)
Access tokenszat_1 hour
Refresh tokenszrt_90 days (rotates on every use)

The code is single-use; if replayed, tokens issued from it are revoked. The refresh token is replaced on every use; if a revoked refresh token is replayed, the WHOLE family is revoked (reuse detection).

redirect_uri rules

redirect_uri must match a registered value as an EXACT string; https is required. Only http loopback addresses (localhost, 127.0.0.1, ::1) may vary the port. Addresses with a fragment (#) are rejected.

Scopes

Apps request the same granular scopes as the Web Service API. The risk class drives the coloured dot on the consent screen: high (writes), protected (personal data), normal.

ScopeMeaningRisk
products:readView your products and variantsNormal
products:writeCreate and edit your productsHigh — writes/changes data
orders:readView your orders — including buyer name and addressProtected — personal data
orders:writeUpdate order statusHigh — writes/changes data
inventory:writeChange stock quantities (sent to marketplaces)High — writes/changes data
prices:writeChange prices (sent to marketplaces)High — writes/changes data
returns:readView returns — including buyer detailsProtected — personal data
returns:writeApprove or reject returnsHigh — writes/changes data
invoices:readView your invoicesProtected — personal data
invoices:writeUpload invoices to ordersHigh — writes/changes data
questions:readView customer questionsNormal
questions:writeAnswer customer questionsNormal
customers:readView your customer list — including contact detailsProtected — personal data
categories:readView your categoriesNormal
brands:readView your brandsNormal
buybox:readView Buy Box statusNormal
shipping:readView shipments — including buyer addressProtected — personal data
shipping:writeCreate shipmentsHigh — writes/changes data
reports:readView your sales reportsNormal
webhooks:manageTurn webhook subscriptions on or off for this appNormal

Webhooks and HMAC verification

Webhook requests carry the headers below. The timestamp is unix seconds; the signature is hex HMAC-SHA256(webhook_secret, "<timestamp>.<raw body>"). The webhook_secret is per app (prefix whsec_) and stored encrypted.

Mandatory topics: app.uninstalled, customer.data_request, customer.redact, shop.redact. The receiver must reject timestamps outside ±5 minutes and deduplicate by Event-Id (replay defence).

HTTP
X-Stokzone-Topic: app.uninstalled
X-Stokzone-Event-Id: 9f1c...
X-Stokzone-Installation-Id: ins_...
X-Stokzone-Timestamp: 1764500000
X-Stokzone-Hmac-Sha256: 4b2a...  (hex)

Verify the signature with a constant-time comparison and sign over the RAW bytes WITHOUT parsing the body:

Node.js
import crypto from "node:crypto";

function verify(req, secret) {
  const ts = req.header("X-Stokzone-Timestamp");
  const sig = req.header("X-Stokzone-Hmac-Sha256");
  // req.rawBody = ham gövde (parse EDİLMEDEN)
  const base = ts + "." + req.rawBody;
  const expected = crypto
    .createHmac("sha256", secret)
    .update(base, "utf8")
    .digest("hex");
  const ok = crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
  const fresh = Math.abs(Date.now() / 1000 - Number(ts)) <= 300;
  return ok && fresh;
}
Python
import hmac, hashlib, time

def verify(headers, raw_body: bytes, secret: str) -> bool:
    ts = headers["X-Stokzone-Timestamp"]
    sig = headers["X-Stokzone-Hmac-Sha256"]
    base = ts.encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), base, hashlib.sha256).hexdigest()
    fresh = abs(time.time() - int(ts)) <= 300
    return hmac.compare_digest(sig, expected) and fresh

Delivery attempts: first 3 fast in-process retries (0, 2, 8 s), then a recovery tick with exponential backoff up to 10 attempts total. After 24 hours an undelivered record expires and its body is deleted.

Rate limits

The OAuth consent endpoint (GET /oauth/authorize) is limited to 60 requests per 60 seconds per user (source: code). The Web Service API's general limits are in a separate guide; rely only on the numbers written in code.

Rate limits guide

Media and listing limits

Icon: PNG/JPEG, square, 256–1200 px, max 1 MB, 1 item. SVG/GIF/HEIC are rejected; images are re-encoded (EXIF/text chunks stripped).

Screenshot: PNG/JPEG/WebP, at least 1280×720, at most 3200×2000, max 2 MB, up to 8 items. Banner: up to 1 item.

Next steps

Explore the store and start building with the API reference.