mypy --strict clean. Mirrors @itemshop/sdk in TypeScript.
Installation
Storefront (public, no secrets)
Checkout
The site never touches payment data:checkout.create returns a redirect_url (the gateway, or the shop’s status page for a free order). The SDK adds a random Idempotency-Key and retries network failures with the same key, so a flaky connection never creates two orders. A cart has 1–20 lines; two or more form one payment group (result.group_id, result.order_ids).
idempotency_key=...) with the cart if retries must stay idempotent across process restarts; itemshop.new_idempotency_key() generates a valid one.
Vouchers and widgets
Client (API key, server-side)
Create a key in the panel under Settings → API keys with only the permissions you need. See API with a key.shops, team, servers, products, payment_methods, blacklist, discounts, vouchers, stats, uploads, orders, payment_errors, site (files, draft, revisions, builds, deployments), templates, agents, skills. AI Workspace settings and tokens are panel-only (API keys are rejected there), so they are not part of this client. Async is identical with await / async for:
Site: deploy from CI
Errors
Every exception is anitemshop.ItemShopError with an always-set code (UPPER_SNAKE_CASE): the backend’s code when it sent one (CART_TOO_LARGE, LEGAL_DOCUMENTS_CHANGED…), otherwise one derived from the status (NOT_FOUND, RATE_LIMITED…), otherwise an SDK code (NETWORK_ERROR, TIMEOUT, CONFIG_ERROR, VALIDATION_FAILED). status is 0 when no response arrived. Non-2xx responses raise a subclass of itemshop.APIStatusError:
Retries and timeouts
GET requests and writes carrying anIdempotency-Key (checkout) are retried on network errors and 408/425/429/500/502/503/504; any other write only on 429. Backoff is exponential from 300 ms, capped at 5 s, with jitter, honouring Retry-After. The rules are shared by all ItemShop SDKs.
Webhooks
The backend does not send signed outgoing webhooks yet (orders reach Discord and the game plugin directly) — see Webhooks.Webhook implements the planned Standard Webhooks scheme (webhook-id, webhook-timestamp, webhook-signature: v1,<base64 HMAC-SHA256>), so you can write the receiver today.
Models
Request/response models live initemshop.models (pydantic v2). Attributes are snake_case; the wire format stays camelCase. Fields unknown to the SDK are kept in model.model_extra, so a newer backend never breaks an older SDK. model.to_dict() returns the wire-format dict.
Storefront API
The endpoints under the SDK.
Errors and limits
Error codes and rate limits.