Webhooks
Subscribe your plugin to events in a merchant's store and receive them as signed HTTP requests at your own HTTPS endpoint.
What outbound webhooks are
Outbound webhooks let Orbit push events to your plugin in near real time. When something happens in a store a product is updated, an order is created, a payment succeeds Orbit sends an HTTP POST to a URL you control. Your plugin does not poll; it reacts.
Webhooks are the right tool for background work that should happen without a merchant sitting in the iframe: syncing inventory to a marketplace, emailing a receipt, reconciling fulfilments. They complement the SDK and the REST/GraphQL surfaces documented in the API Reference.
Every subscription and delivery is scoped to a single store. The store_id in each payload tells you which merchant install the event belongs to.
Subscribing
Create a subscription with POST /v1/webhooks. Authenticate with a plugin access token.
POST /v1/webhooks HTTP/1.1
Host: api.myorbitcommerce.net
Authorization: Bearer <access-token>
x-store-id: <store-id>
Content-Type: application/json
{
"topic": "order.created",
"webhookUrl": "https://your-plugin.example.com/webhooks/orbit"
}
Subscribing requires two scopes:
webhook:createalways.- The topic's own scope. For example, to subscribe to any
order.*topic you also needorder:read. The mapping is in the table below, and the full list is on the Scopes guide and the Scope Catalog.
| Status | Meaning |
|---|---|
201 Created | Subscription created. |
400 Bad Request | Invalid topic or webhookUrl. |
403 Forbidden | Token is missing webhook:create or the topic's required scope. |
409 Conflict | A subscription for this topic and URL already exists. |
The webhookUrl must be HTTPS.
Managing subscriptions
| Method and path | Required scope | Purpose |
|---|---|---|
GET /v1/webhooks | webhook:list | List your store's subscriptions. |
DELETE /v1/webhooks/{id} | webhook:delete | Remove a subscription. |
GET /v1/webhooks/{id}/deliveries | webhook:read | Inspect recent delivery attempts for a subscription. |
Use GET /v1/webhooks/{id}/deliveries when debugging: it shows what Orbit attempted to send and how your endpoint responded.
Topic catalog
Each topic requires the listed scope at subscribe time, in addition to webhook:create.
| Topic | Required scope |
|---|---|
product.created | product:read |
product.updated | product:read |
product.deleted | product:read |
order.created | order:read |
order.updated | order:read |
order.canceled | order:read |
order.confirmed | order:read |
fulfillment.created | order:read |
fulfillment.updated | order:read |
payment.succeeded | order:read |
payment.failed | order:read |
payment.awaiting_manual | order:read |
payment.refunded | order:read |
payment.partial_refund | order:read |
payment.canceled | order:read |
plugin.installed | none (lifecycle event) |
plugin.activated | none (lifecycle event) |
plugin.deactivated | none (lifecycle event) |
plugin.uninstalled | none (lifecycle event) |
The plugin.* lifecycle topics require no resource scope only webhook:create to subscribe. They are useful for provisioning and cleanup when a merchant installs or removes your plugin.
The delivery request
Orbit delivers each event as an HTTP POST to your webhookUrl:
Content-Type: application/jsonUser-Agent: OrbitCommerce-Webhook/1.0- A 10 second timeout. If your endpoint does not respond in time, the attempt counts as failed.
- Retries up to roughly 4 attempts on any non-2xx response (or timeout). Return a 2xx status to acknowledge.
Each delivery carries these headers:
| Header | Description |
|---|---|
X-Orbit-Webhook-Id | Unique delivery and event id. Use it as an idempotency key. |
X-Orbit-Webhook-Topic | The topic, for example order.created. |
X-Orbit-Webhook-Signature | HMAC-SHA256 signature, formatted sha256=<hex>. |
X-Orbit-Webhook-Timestamp | ISO 8601 time the delivery was sent. |
The envelope
The request body is a JSON envelope with the same outer shape for every topic:
{
"id": "0f3c8b2a-1d4e-4a6b-9c2f-7e5a1b2c3d4e",
"topic": "order.created",
"created_at": "2026-05-30T12:34:56.000Z",
"store_id": "8a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
"data": {}
}
idthe unique event id; matchesX-Orbit-Webhook-Id. Treat it as your idempotency key.topicthe event topic; matchesX-Orbit-Webhook-Topic.created_atISO 8601 timestamp.store_idthe store this event belongs to. Use it to load the right merchant install record.datathe event-specific payload. Its fields depend on the topic and are documented in the API Reference.
Verify the signature
Always verify the signature before trusting or processing a delivery. Recompute the HMAC over the raw request body using your plugin's webhook signing secret, prefix it with sha256=, and compare against the X-Orbit-Webhook-Signature header using a timing-safe comparison.
You must verify against the exact bytes Orbit sent. Capture the raw body before any JSON parsing reorders or reformats it.
import crypto from 'node:crypto';
const WEBHOOK_SECRET = process.env.ORBIT_WEBHOOK_SECRET!;
export function verifyOrbitSignature(rawBody: Buffer, signatureHeader: string): boolean {
const expected =
'sha256=' +
crypto.createHmac('sha256', WEBHOOK_SECRET).update(rawBody).digest('hex');
const a = Buffer.from(expected);
const b = Buffer.from(signatureHeader ?? '');
// Lengths must match for timingSafeEqual; an early length check is itself safe.
if (a.length !== b.length) return false;
return crypto.timingSafeEqual(a, b);
}
In Express, preserve the raw body so the bytes are not mutated before you hash them:
import express from 'express';
const app = express();
// Capture the raw body for this route only.
app.post(
'/webhooks/orbit',
express.raw({ type: 'application/json' }),
(req, res) => {
const signature = req.header('X-Orbit-Webhook-Signature') ?? '';
if (!verifyOrbitSignature(req.body, signature)) {
return res.status(401).send('invalid signature');
}
const event = JSON.parse(req.body.toString('utf8'));
// event.id, event.topic, event.store_id, event.data
res.status(200).send('ok');
// Do the real work after responding (queue, worker, etc.).
},
);
Idempotency
Retries mean your endpoint can receive the same event more than once. Use the event id (also sent as X-Orbit-Webhook-Id) as an idempotency key: record processed ids and skip any you have already handled. Because deliveries can arrive out of order, prefer comparing the resource's current state in data over assuming a strict sequence.
Best practices
- Respond 2xx fast. Acknowledge within the 10 second timeout, then do slow work asynchronously (a queue or background worker). Holding the connection open to finish processing risks a timeout and an unnecessary retry.
- Verify before processing. Reject any request whose signature does not match before you read
data. Never act on an unverified payload. - HTTPS only. Your
webhookUrlmust be HTTPS, and tokens or secrets must never appear in logs. - Be idempotent. Deduplicate on the event
id; the same event may be delivered more than once. - Subscribe to lifecycle topics. Use
plugin.installedandplugin.uninstalledto provision and clean up per-store state. - Request only the scopes you need. Each topic requires its resource scope at subscribe time; see the Scopes guide.
When a delivery looks wrong, inspect attempts with GET /v1/webhooks/{id}/deliveries, and consult the API Reference for the per-topic data shapes.