Webhooks
SwiftPage receives all Shopify webhooks at a single endpoint,POST {APP_URL}/webhooks/shopify, and differentiates by the X-Shopify-Topic header.
Subscribed topics
The three operational topics and the billing topic are registered through the Admin GraphQL API during OAuth or managed installation, and are also declared in
shopify.app.toml so a deployed app version enrolls shops installed before a topic was added. The three GDPR topics are declared as compliance_topics.
Signature verification
Every incoming webhook is verified before processing:- Import the app secret as an HMAC key.
- Sign the raw request body with HMAC-SHA256.
- Base64-encode the result.
- Compare it against
X-Shopify-Hmac-Sha256using a timing-safe comparison.
X-Shopify-Hmac-Sha256, X-Shopify-Topic, and X-Shopify-Shop-Domain. Missing headers return 400; an invalid signature returns 401 { "error": "Invalid webhook signature" } before any handler side effect.
Processing rules
- Verify the HMAC signature at the edge, before any processing.
- Capture the raw body and the critical headers (including
X-Shopify-Webhook-Idfor replay-safeshop/redacthandling). - Validate the signed payload shape for effectful topics.
- Route by
X-Shopify-Topicand perform the lightweight database operation. - Return
200for accepted deliveries,401for an invalid signature, or503when a retryable lifecycle condition applies.
shop/update, the payload’s myshopify_domain must match the shop header; for domains/update, the handler requires a flat Domain resource (id, host/domain, ssl_enabled) at the payload root and no top-level myshopify_domain. Malformed or relabeled payloads return 400. Domain refresh uses a bounded budget; timeouts, Admin API failures, and compare-and-set conflicts return 503 so Shopify retries.
OAuth callback
The callback that triggers webhook registration isGET /auth/callback. It validates the state and hmac parameters, exchanges the authorization code for an access token, protects the token at rest, registers the operational topics, and redirects the merchant into the embedded app.
Pcnaid Documentation › Shopify Ecosystem › SwiftPage › Developer