Webhooks
Webhooks notify your application when events occur in your store — such as order confirmations, payment completions, or low inventory alerts.Setting Up
Create a webhook via the Admin API:secret for verifying webhook signatures.
To subscribe to all events, use the wildcard *:
Event Types
Payload Format
Signature Verification
Every webhook delivery includes anX-Webhook-Signature header (HMAC-SHA256). Always verify this before processing.
Using the SDK helper
Manual verification
If you are not using the SDK, compute the signature yourself:Idempotency
HTTP Idempotency Keys
Use idempotency keys to safely retry POST requests without creating duplicate resources. Include anIdempotency-Key header with a unique value (UUID recommended).
Key rules:
- Keys must be unique per request — use UUIDs
- Keys are scoped to the store (API key)
- Cached responses expire after 24 hours
- Only successful responses (2xx) are cached
- The
Idempotency-Keyheader is optional. If omitted, the request is processed normally
Idempotent Webhook Processing
Webhooks may be delivered more than once (due to retries, network issues, or infrastructure failover). Your handler must be idempotent.Retry Policy
Failed deliveries are retried with exponential backoff:
After 5 consecutive failures, the webhook endpoint is marked as inactive and a notification is sent to the dashboard.
Fast response best practices
Event Ordering
Events may arrive out of order. For example,order.paid might arrive before order.created due to network conditions.
Strategy: Use timestamps, not arrival order
- Store the event in a pending queue
- When the prerequisite event arrives (e.g.,
order.created), process it first - Then replay any pending events for that resource
Queue-Based Processing
For production workloads, accept webhooks into a queue and process them asynchronously.With Inngest
With BullMQ
Testing
Send a test event
Use the Admin API to send a test event to your webhook endpoint:"test": true in the payload so you can distinguish test events from real ones.
Local development with ngrok
To receive webhooks on your local machine during development:Next Steps
Stripe Integration
Set up Stripe payments with webhook-driven confirmation.
TossPayments
Set up TossPayments with webhook-driven confirmation.
Recipes
Practical code recipes covering common commerce flows.
Error Handling
API error codes and recommended handling strategies.