Webhooks Overview
Webhooks allow your application to receive real-time notifications about important events occurring in Manastore. Instead of polling the API, webhooks push event data directly to your application’s endpoint.Webhook Events
Order Events
An event is sent each time an order’s
fulfillment_status changes to one of the statuses above. There is no separate failed event: an order that can’t be fulfilled ends as order.cancelled or order.refunded.
Registering a Webhook
To register a webhook:- Log in to your Manastore account and navigate to Account Settings → Webhook
- Enter your public HTTPS URL endpoint in the webhook URL field
- Save your settings — Manastore will immediately begin sending events to your endpoint
https and resolve to a public IP address. Private, loopback and link-local addresses are rejected, and redirects are not followed.
Webhook Payload Format
All webhook events follow this standard format:data reflects the order as it is when the request is sent. If an order changes status again quickly, an earlier event can already show the newer fulfillment_status, so rely on event to know what happened.
Each request also includes these headers:
Example Payloads
Order Fulfilled Event
event and the matching fulfillment_status (partially_fulfilled, cancelled, refunded or partially_refunded).
Once the order is fulfilled, retrieve the codes with the Get Codes endpoint. Webhook payloads never contain codes.
Verifying Signatures
Every request is signed with your webhook signing secret. You can view, copy and rotate it under Account Settings → Webhook → Signing Secret once a webhook URL is saved. TheX-Manastore-Signature header looks like this:
tis the Unix timestamp when the request was signedv1is a hex encoded HMAC SHA-256 of{t}.{raw request body}using your signing secret as the key
- Read the raw request body before parsing it as JSON
- Split the header into
tandv1 - Compute
HMAC_SHA256(secret, t + "." + body)and compare it tov1using a constant-time comparison - Reject the request if the signatures don’t match, or if
tis more than 5 minutes old
Retries
A delivery counts as successful when your endpoint returns a2xx status. Redirects (3xx) are not followed and count as failures.
Failed deliveries are retried: a few quick attempts first, then again after about 1 minute, 5 minutes, 15 minutes and 1 hour. Every retry has the same id.
Best Practices
- Return Quickly: Return a 2xx response right away and do any heavy processing afterwards
- Verify Signatures: Always check
X-Manastore-Signaturebefore acting on a webhook - Deduplicate: Use the event
idto ignore deliveries you have already handled - Confirm via the API: For anything that moves money or stock on your side, fetch the order from the API before acting
- Timeout: Your endpoint must respond within 10 seconds