Error Format
All error responses follow a consistent structure:Reading the Errors Array
Theerrors array is ordered from root cause to top-level caller:
errors[0]— the root cause of the failure (most useful for debugging)errors[n]— the top-level caller that surfaced the error
errors[0].message for the actionable error description.
HTTP Status Codes
Error layer Field
Each error includes a layer string indicating which part of the system produced the error. Use the layer value alongside message to identify the root cause when debugging.
Common Error Scenarios
Authentication Errors (401)
- Verify your Merchant ID and private key are correct
- Ensure the SDK is initialized with valid credentials
- Check that your private key matches the registered public key
Validation Errors (400)
- Check required fields are present
- Verify field value formats and constraints
- Ensure amounts are display format strings (e.g., “29.00”)
Permission Errors (403)
- Verify the API Key has the required permissions
- Ensure the user belongs to the correct store
Idempotency Conflicts (409)
- Wait for the original request to complete
- Use a different
X-Idempotency-Keyfor a new request
Handling Errors in Code
TypeScript SDK
Retry Strategy
Retry these status codes with exponential backoff:- 429 — Rate limited (respect
Retry-Afterheader if present) - 500 — Internal server error
- 502 — Bad gateway
Do not retry
400, 401, 403, or 404 errors. These indicate issues that must be fixed in the request itself.Idempotency for Safe Retries
A write operation can be retried safely without creating duplicates when it carries anX-Idempotency-Key.
Nothing is deduplicated unless you send a key. The SDKs used to derive one from
merchantId + path + body; they no longer do, on any credential — so by default a write retried after a timeout executes twice.Through an SDK, pass the key per call ({ idempotencyKey } in TypeScript and @waffo/pancake-nextjs, pancake.WithIdempotencyKey(key) in Go). Calling REST directly, set the header yourself. The requirements below apply to both.- Idempotency keys are cached for 24 hours
- Sending the same key returns the cached response
- If the original request is still processing, returns
409 Conflict
Idempotency Key Requirements
The key is the entire cache identity of the request, so uniqueness is the requirement to plan for. Embed your
merchantId and a high-entropy component such as a UUID, e.g. MER_2aUyqjCzEIiEcYMKj7TZtw-8f14e45f-ea8c-4b0a-9f7d-3b2c1d0e5a67. A key built from a hash of the request body is a poor choice: two legitimately identical writes would collide and the second would replay the first response.
A short, guessable key such as order-abc-123 can match a key already used by a different request. In that case the response you receive is that request’s cached response, not a result for your own call.