Skip to main content

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:
  1. Log in to your Manastore account and navigate to Account Settings → Webhook
  2. Enter your public HTTPS URL endpoint in the webhook URL field
  3. Save your settings — Manastore will immediately begin sending events to your endpoint
The URL must use 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

The other order events use the same structure with a different 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. The X-Manastore-Signature header looks like this:
  • t is the Unix timestamp when the request was signed
  • v1 is a hex encoded HMAC SHA-256 of {t}.{raw request body} using your signing secret as the key
To verify a request:
  1. Read the raw request body before parsing it as JSON
  2. Split the header into t and v1
  3. Compute HMAC_SHA256(secret, t + "." + body) and compare it to v1 using a constant-time comparison
  4. Reject the request if the signatures don’t match, or if t is more than 5 minutes old
Rotating the secret takes effect immediately, so update your endpoint with the new secret right after rotating.

Retries

A delivery counts as successful when your endpoint returns a 2xx 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-Signature before acting on a webhook
  • Deduplicate: Use the event id to 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