Docs
Back to site Sign in

Webhooks

Webhooks

Otis can POST to your server the moment something important happens in a store, so your own systems stay in step without polling the API. You subscribe an endpoint to the events you care about, we sign and deliver each one, and we keep retrying until you acknowledge it.

Set up endpoints in the app. Go to Settings > Account > Webhooks to add an endpoint, choose its events, and inspect every delivery.

What you can subscribe to#

An endpoint is subscribed to one or more event types. Each delivery names its type in the Total-Commerce-Event header and the envelope's type field.

Order events#

EventWhen it fires
order.createdA new order (billing contract) was created for a client.
order.updatedAn existing order changed in Shopify. Today that means its shipping or billing address was edited.

order.updated carries exactly the same payload as order.created, refreshed to the order's current state, so you can handle both with the same code. It fires only when the change actually altered our record of the order, not every time Shopify touches it, so you will not see one for a tag, a note or a fulfilment update.

Note that the payload's shippingAddress reflects the edit, but the order's billing address is not part of the payload. If you need the new billing address, read the order back from the API.

Order item status values#

Each item in an order payload carries a numeric status. Since August 2026 there is a fifth value:

ValueStatusMeaning
1ActiveLive. Out with the customer, or billing on its cycle.
2CompleteFinished. It went out and came back, or otherwise ran its course.
3NewPlaced, not yet actioned.
4HeldWaiting on something before it can start, most often a fulfilment location.
5CancelledEnded before it ever went out, so it was never with the customer.

5 is new, so treat an unrecognised status as a value you may not have seen before rather than an error, and make sure your integration does not assume the set stops at 4. Existing values have not changed and will not be renumbered.

An item reaches 5 when it never went out (3 or 4) and either the order is cancelled in Shopify or its line is removed by a Shopify order edit. An item that was already 1 when that happened becomes 2 instead. See Orders for the merchant-facing view of the same behaviour.

Subscription events#

EventWhen it fires
subscription.defaultedA subscription was automatically paused because its payment retries were exhausted (in default).
subscription.recoveredA previously-defaulted subscription was reactivated and is no longer in default.
subscription.pausedA subscription was manually paused. Billing is stopped until it is unpaused.
subscription.resumedA paused subscription was unpaused. Billing resumes from its next cycle.
subscription.cancelledA subscription was cancelled. No further billing will occur.
subscription.reactivatedA cancelled subscription was reactivated and billing has resumed.
subscription.cycle_skippedA subscription billing cycle was skipped. That cycle will not be charged.
subscription.cycle_abandonedA subscription billing cycle was abandoned. It will not be retried or charged, and billing resumes from the next cycle.

Payment events#

EventWhen it fires
payment.succeededA subscription payment succeeded.
payment.failedA subscription payment failed on its first attempt.
payment.retry_scheduledA failed payment has been scheduled for retry.
payment.retries_exhaustedA payment's retries were exhausted; the subscription will be defaulted.
payment.recoveredA payment succeeded on retry after an earlier failure.

Product events#

EventWhen it fires
product.createdA product was created.
product.updatedA product was updated.
product.deletedA product was deleted.

A payment that clears on its first attempt sends payment.succeeded. A payment that clears only after an earlier failure sends payment.recovered, and if that recovery lifts the subscription out of default you also receive subscription.recovered, so subscribe to both if you track default state.

Return events#

EventWhen it fires
return.requestedA return was requested for a subscription or calendar rental.
return.actionedA return was booked for collection or drop-off.
return.completedA returned item was received and the return completed.
return.cancelledA return was cancelled before the item was received.

The data object describes the return: its status (requested, actioned, completed or cancelled) and type, the order item and Shopify order, the product, rental dates (for calendar rentals), the customer's contact details, the collection address, the reason and the request, booking and completion times. A cancelled return also carries cancelledAtUtc, when it was cancelled, and cancellationReason, the reason given. Every return also carries bookingUrl, the booking link a connected warehouse application stored for it (null until one is stored), and a calendar rental return carries its rental's overdueSinceUtc inside rental, when the rental was flagged overdue (null when it isn't).

A return can be cancelled while it is still requested or actioned. Use return.cancelled to close anything you hold for it, such as a collection booking. A return opened by a swap can't be cancelled, so you never receive return.cancelled for one.

Rental events#

EventWhen it fires
rental.overdueA calendar rental was first detected overdue.

A calendar rental is overdue once it is still out the day after its end date plus the late-return grace period set on its rental profile. Otis checks once a day (using the UK date), flags the rental, emails the customer, and sends rental.overdue, once per overdue. If a date change takes a rental out of overdue and it later becomes overdue again, you receive a new rental.overdue for it.

The data object describes the rental:

{
  "orderItemId": "e0000000-0000-4000-8000-000000000103",
  "shopifyOrderId": 5551234567,
  "shopifyOrderNumber": 4821,
  "product": { "title": "Mobility Scooter S2", "variantTitle": "Red", "sku": "MS2-RED" },
  "startDate": "2026-10-10",
  "endDate": "2026-10-24",
  "graceDays": 2,
  "overdueSinceUtc": "2026-10-27T00:05:00Z",
  "physicalId": "WV-000123",
  "returnId": null,
  "customer": { "firstName": "Sam", "lastName": "Patel", "email": "sam@example.com", "phone": "+447700900123" }
}

startDate and endDate are calendar dates (yyyy-MM-dd), and overdueSinceUtc is UTC. graceDays is the product's late-return grace period. physicalId is the barcode of the asset out on the rental, or null when no asset is recorded for it, and returnId is the rental's current return, or null when none has been raised.

Like the return events, rental.overdue can be sent to an organisation-wide endpoint, which receives it for every client in your organisation, or to a client-scoped endpoint, which receives it for that client only. The envelope's clientId says which client the rental belongs to, so filter on it if one endpoint serves several clients, such as a warehouse application that handles only some of them.

Managing endpoints#

You create and manage endpoints under Settings > Account > Webhooks. The page has two tabs: Endpoints, where you configure who receives what, and Deliveries, where you inspect and replay what was sent.

To add one, click Add endpoint and set:

  • URL, an https:// address we POST to. Plain http and internal or private addresses are rejected.
  • Events, the types this endpoint receives.
  • Schema version, v1 for new endpoints (see Schema versions).

When you save a v1 endpoint we show its signing secret once. Copy it then, store it somewhere safe, and use it to verify signatures. If you lose it, use Rotate secret to issue a new one.

From an endpoint's actions menu you can disable or enable it, rotate its secret, send a test event, and delete it. A disabled endpoint receives nothing until you re-enable it.

Organisation-wide and per-client endpoints#

An endpoint is either organisation-wide, receiving events for every client in your organisation, or scoped to a single client, receiving only that client's events. Choose the scope when you create the endpoint.

What a delivery looks like#

Every v1 delivery is a POST with a JSON envelope and a set of Total-Commerce-* headers.

POST /total-commerce-webhook HTTP/1.1
Content-Type: application/json
Total-Commerce-Event: subscription.defaulted
Total-Commerce-Event-Id: 7f3c1e94-8a2b-4d51-9e0a-2c6f5b1d0e77
Total-Commerce-Delivery-Id: b2a6d0c3-4e11-49aa-9f2e-1d7c8e5a4b90
Total-Commerce-Delivery-Attempt: 1
Total-Commerce-Webhook-Id: 4c9f2a10-6b3d-4e88-a1c2-9f0e7d6b5a43
Total-Commerce-Schema-Version: v1
Total-Commerce-Signature: t=1754937000,v1=3f9a4e7c1b0d8a6f5e2c9b4a1d0f7e6c5b4a3d2e1f0c9b8a7d6e5f4c3b2a1d0e
{
  "id": "7f3c1e94-8a2b-4d51-9e0a-2c6f5b1d0e77",
  "type": "subscription.defaulted",
  "apiVersion": "v1",
  "occurredAt": "2026-08-11T18:30:00Z",
  "organisationId": "1b0c8f2e-3d4a-45b6-9c7d-8e9f0a1b2c3d",
  "clientId": "a5e2d1c0-4b3a-49f8-8e7d-6c5b4a3d2e1f",
  "data": {
    "subscriptionId": "d4c3b2a1-0f9e-48d7-b6c5-a4d3e2f1c0b9",
    "clientId": "a5e2d1c0-4b3a-49f8-8e7d-6c5b4a3d2e1f",
    "status": "defaulted"
  }
}

The envelope fields are the same for every event:

FieldMeaning
idThe event id. Stable across retries and replays, so use it to de-duplicate (see Idempotency).
typeThe event type, e.g. subscription.defaulted.
apiVersionThe schema version, v1.
occurredAtWhen the event happened, UTC, ISO 8601.
organisationIdThe organisation the event belongs to.
clientIdThe client the event belongs to, or null for an organisation-wide event that spans clients.
dataA snapshot of the resource the event is about.

The shape of data depends on the event type. Open the in-app API reference under Settings > Account > API Documentation for the exact fields of each event.

Verifying the signature#

Every v1 delivery carries a Total-Commerce-Signature header:

Total-Commerce-Signature: t=1754937000,v1=3f9a4e7c...

t is the Unix time (seconds) when we signed the request. v1 is the lowercase hex HMAC-SHA256 of the string <t>.<body>, keyed with your endpoint's signing secret, where <body> is the exact bytes we posted. To verify a request, recompute the HMAC over the raw body you received, before parsing it as JSON, and compare in constant time. Reject the request if the timestamp is too old, which blunts replay attacks.

const crypto = require('crypto');
const express = require('express');

// Shown once when you create (or rotate) the endpoint.
const SIGNING_SECRET = process.env.TOTAL_COMMERCE_SIGNING_SECRET;
const TOLERANCE_SECONDS = 5 * 60;

function isValid(rawBody, signatureHeader) {
  // Header looks like: t=1754937000,v1=3f9a...c2
  const parts = Object.fromEntries(
    (signatureHeader || '').split(',').map((p) => p.split('='))
  );
  const timestamp = Number(parts.t);
  const provided = parts.v1 || '';

  const age = Math.floor(Date.now() / 1000) - timestamp;
  if (!Number.isFinite(timestamp) || age > TOLERANCE_SECONDS) return false;

  const expected = crypto
    .createHmac('sha256', SIGNING_SECRET)
    .update(`${timestamp}.${rawBody}`)
    .digest('hex');

  const a = Buffer.from(expected);
  const b = Buffer.from(provided);
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}

const app = express();

app.post(
  '/total-commerce-webhook',
  express.raw({ type: 'application/json' }), // keep the raw bytes
  (req, res) => {
    const rawBody = req.body.toString('utf8');
    if (!isValid(rawBody, req.get('Total-Commerce-Signature'))) {
      return res.status(401).send('invalid signature');
    }

    const event = JSON.parse(rawBody);
    // De-duplicate on event.id, then handle event.type.
    res.sendStatus(200);
  }
);

Responding to a delivery#

Return any 2xx status, quickly, to acknowledge a delivery. Do the slow work asynchronously: read the body, enqueue it, and respond. We wait up to 10 seconds for a response, so acknowledge first and process afterwards.

A 408, 425, 429, any 5xx, a timeout, or a connection error is treated as a temporary failure and retried. Any other 4xx is treated as permanent and is not retried, so return 2xx even for events you choose to ignore.

Retries and delivery reliability#

If a delivery fails temporarily, we retry it with a fixed backoff. There are up to seven attempts in total: the first is immediate, and the remaining six are spaced 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, then 24 hours apart. If all seven fail, the delivery is dead-lettered and stops retrying.

When an endpoint dead-letters 20 deliveries in a row, we automatically disable it, and organisation admins who have subscribed to the notification are told. Fix your endpoint, re-enable it under Settings > Account > Webhooks, and replay whatever you missed.

Every attempt is recorded. Open the Deliveries tab to see each delivery's status, its attempts, the response we captured, and to search by event type, id, or the delivery body.

Replaying deliveries#

You can replay a delivery from the Deliveries tab: a single delivery from its row, or a whole filtered set with bulk replay. A replay is a fresh delivery of the same event, so it reuses the event's id but gets a new Total-Commerce-Delivery-Id.

Idempotency#

Deliveries are at-least-once: a retry or a replay can send the same event more than once. Treat Total-Commerce-Event-Id (the envelope's id) as the idempotency key, record the ids you have processed, and ignore one you have already handled. It stays the same across every retry and replay of an event, while Total-Commerce-Delivery-Id is unique per delivery.

Schema versions (v1 and legacy)#

Endpoints render in one of two schema versions.

  • v1 is the current version and the default for new endpoints. It signs every request, wraps the payload in the envelope above, and can subscribe to any event in the catalogue.
  • legacy exists only for backwards compatibility with the original per-client order-created webhook. A legacy endpoint receives order.created only, as the bare order payload with no envelope and no signature. Existing order-created webhooks were migrated to legacy endpoints automatically, so their body is unchanged, but they now gain retries, the deliveries log, and replay.

If you are on a legacy endpoint, use Upgrade to v1 in its actions menu to move to the signed, enveloped format and unlock the full event catalogue.

Order events across multiple clients#

An order can span more than one client. To keep each client's data isolated, order.created and order.updated are each delivered in two shapes:

  • A client-scoped endpoint receives a per-client slice, containing only that client's items.
  • An organisation-wide endpoint receives the combined order, containing every client's items, with clientId set to null.

A client-scoped endpoint never receives another client's items or the combined payload. If you run reconciliation off webhooks, subscribe an organisation-wide endpoint for the full picture and client-scoped endpoints for per-client feeds.

  • API access, how to reach the full API reference and generate keys.
Was this page helpful?
Still stuck? Email us