Overview
Webhooks allow your Spree store to send real-time HTTP POST notifications to external services when events occur. When an order is completed, a product is updated, or inventory changes, Spree can automatically notify your CRM, fulfillment service, analytics platform, or any other system. Webhooks are built on top of Spree’s event system, providing:- Multi-store support - Each store has its own webhook endpoints
- Event filtering - Subscribe to specific events or patterns with wildcards
- Secure delivery - HMAC-SHA256 signatures for payload verification
- Automatic retries - Failed deliveries retry with exponential backoff
- Full audit trail - Track every delivery attempt with response codes and timing
How Webhooks Work
- An event is published (e.g.,
order.completed) - The
WebhookEventSubscriberreceives all events - It finds active webhook endpoints subscribed to that event
- For each endpoint, it creates a
WebhookDeliveryrecord and queues a job - The job sends an HTTP POST request with the event payload and HMAC signature
Creating Webhook Endpoints
Via Admin Panel
Navigate to Settings → Developers → Webhooks in the admin panel to create and manage webhook endpoints.Via the Admin API
Endpoint Attributes
Endpoints always belong to the current store — the association is set automatically from the request scope, so you never pass it when creating or updating an endpoint.
Event Subscriptions
Thesubscriptions attribute controls which events trigger webhooks to this endpoint. Set it when creating the endpoint, or change it later:
subscriptions array accepts exact event names and wildcard patterns:
Webhook Payload
Each webhook delivery sends a JSON payload with the following structure. Thedata object uses the same Store API V3 serializers as the REST API, so webhook payloads and API responses share the same schema:
For complete payload schemas for each event type, see Webhook Events & Payloads.
HTTP Request Details
Headers
Each webhook request includes these headers:Verifying Webhook Signatures
To ensure webhooks are genuinely from your Spree store, verify the signature.Next.js
The Spree Storefront includes a ready-made webhook route handler with signature verification and event routing. See the storefront email docs for details.Any JavaScript/TypeScript framework
Use@spree/sdk/webhooks for framework-agnostic verification:
Ruby
Delivery Status & Retries
Automatic Retries
Failed webhook deliveries automatically retry up to 5 times with exponential backoff. This handles temporary network issues and endpoint downtime.Checking Delivery Status
Inspect an endpoint’s delivery log, and re-send a failed delivery, via the Admin API:Delivery Attributes
Configuration
Enabling/Disabling Webhooks
Webhooks are enabled by default. To disable globally:SSL Verification
SSL verification is enabled by default in production. In development, it’s disabled to allow testing with self-signed certificates:Available Events
Webhooks can subscribe to any event in Spree’s event system. See Events for a complete list. Common webhook events include:Testing Webhooks
In Development
Use tools like ngrok or webhook.site to test webhooks locally. Create a test endpoint pointed at the tunnel:send_test delivers a synthetic webhook.test event so you can verify the endpoint is reachable and your signature-verification code works, without having to trigger a real order.
In Tests
Best Practices
Respond quickly
Return a 2xx response as fast as possible. Process webhook data asynchronously in a background job.
Verify signatures
Always verify the
X-Spree-Webhook-Signature header to ensure the webhook is authentic.Handle duplicates
Use the event
id to detect and handle duplicate deliveries. Webhooks may be retried.Subscribe selectively
Only subscribe to events you need. Use specific patterns rather than
* when possible.Troubleshooting
Webhooks Not Delivering
- Check that webhooks are enabled:
Spree::Api::Config.webhooks_enabled - Verify the endpoint is active:
endpoint.active? - Confirm the endpoint subscribes to the event:
endpoint.subscribed_to?('order.completed') - Check the event has a
store_idmatching the endpoint’s store
Signature Verification Failing
- Ensure you’re using the raw request body (not parsed JSON)
- Verify you’re using the correct
secret_keyfor this endpoint - Check that no middleware is modifying the request body
Deliveries Failing
Check the delivery records for details — each carrieserror_type, request_errors, response_code, and response_body. Filter the log with Ransack predicates such as success_eq=false or event_name_eq:
Related Documentation
- Events - Understanding Spree’s event system
- Admin SDK - Setting up the
@spree/admin-sdkclient used in the management examples above - Customization Quickstart - Overview of all customization options
- Dependencies - Customizing Spree services

