github.com/itemshop/sdk-go — no dependencies (just net/http), Go ≥ 1.23 (iter.Seq2 iterators). Every method takes a context.Context and returns (result, error).
Installation
Storefront (no key)
Checkout.Createfills inconsents.legalVersionfromShop.Legal.Versionand always sends anIdempotency-Key(generated orinput.IdempotencyKey), so a retry after a dropped connection never creates a second order. The Turnstile token is optional.- A cart has 1–20 lines (
Items); two or more form one payment group (GroupID,OrderIDsin the result), more than 20 →CART_TOO_LARGE. The oldOrderIDFromReturnURL/Orders.Statusserve pre-3.0 orders only. Vouchers.Redeemis not retried (except on 429).- Widgets:
sf.Widgets.RecentPurchases,TopSpenders,MonthlyGoal,OnlinePlayers— switched off by the owner they return empty results, not an error. nullablefields in response types are pointers.
API client (with a key)
Shops, Servers, Products, PaymentMethods, PaymentErrors, Blacklist, Discounts, Vouchers, Stats, Uploads, Orders plus the hand-written Site, Templates, Workspace, Agents, Skills. Workspace tokens need a panel session — with an API key you get 401/403. For an endpoint without a method: client.Do(ctx, "GET", "/api/v2/…", nil, &out). Optional fields in api.* types are pointers — helpers itemshop.String/Bool/Float/Int/Ptr.
Errors
Every failure is an*itemshop.Error (the storefront package uses the same type):
BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, CONFLICT, VALIDATION_FAILED, RATE_LIMITED, SERVER_ERROR, NETWORK_ERROR, TIMEOUT, ABORTED… — the same as in the TypeScript SDK.
Retries, timeouts, idempotency
- 2 retries by default (
WithMaxRetries), backoff 300 ms·2ⁿ (max 5 s) with jitter;Retry-Afterreplaces the delay. - GET/HEAD and requests carrying an
Idempotency-Key(Orders.Create,Checkout.Create,itemshop.WithIdempotencyKey) are retried on network errors, timeouts and 408/425/429/500/502/503/504. - Other writes — only on 429.
WithTimeoutlimits one attempt (30 s default); thecontextbounds the whole call including retries.- Options:
WithBaseURL(or$ITEMSHOP_API_BASE),WithHTTPClient,WithUserAgent,WithLocale,WithHeader.
Webhooks
The backend sends no signed webhooks to shop owners (notifications go to Discord — see Webhooks), so the SDK has no signature verifier.Storefront API
The endpoints under the SDK.
Errors and limits
Error codes and rate limits.