Developers
Guides

Receive webhooks

Orders, stock and products pushed in real time: declare, verify the signature, apply.

Rather than polling the API, let QuoShop notify your system: an order placed on the storefront, a shipment decided in QuoSuite, a goods receipt that changes the stock, a price changed in the ERP — a signed JSON POST goes to your address within seconds.

Store events

EventWhenScope
order.createdNew order — placed on the storefront or created through the API.orders:read
order.status_changedStep change: confirmed (posted to the ERP), prepared, shipped, delivered or cancelled. previous.status gives the step left.orders:read
order.paidPayment recorded on the order (paymentStatus, totals.paid up to date; previous.paid gives the amount paid before).orders:read
order.cancelledOrder cancelled (documents cancelled, issued stock put back).orders:read
product.publishedProduct put on sale on the store.catalog:read
product.updatedPublished product page modified: content, images, price (including a sale price changed in the ERP).catalog:read
product.unpublishedProduct withdrawn from sale (unpublished, removed from the store, or article archived in the ERP). data only carries its identity: it can no longer be read through the API.catalog:read
inventory.updatedSellable stock of a published product modified (sale, receipt, adjustment, reservation or release by an order). Close changes are grouped: data is always the stock at delivery time.inventory:read
customer.createdNew buyer account on the store.customers:read
customer.updatedBuyer account modified (profile, address book).customers:read

Body details: Webhook events. data is the resource as GET would return it — a full order, a full product page, a stock figure — and never more than the key can read.

  • inventory.updated is grouped: twenty close movements of the same article make one delivery, and data.available is the stock at delivery time — a value to apply, not a delta.
  • product.unpublished only carries the product’s identity (id, slug, sku, reason): it can no longer be read.
  • order.status_changed gives the step left in previous.status.

1. Declare your receiving endpoint

With your integration’s key (scope webhooks:write); the endpoint belongs to the key and disappears with it:

POST/webhooks/endpoints

curl -X POST 'https://quosuite.com/api/public/v1/quoshop/webhooks/endpoints' \
  -H "Authorization: Bearer $QUOSHOP_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "url": "https://shop.example.com/wp-json/quoshop/v1/webhook",
  "events": [
    "order.created",
    "order.status_changed",
    "order.paid",
    "order.cancelled",
    "inventory.updated",
    "product.published",
    "product.updated",
    "product.unpublished"
  ],
  "stores": [
    "my-store"
  ],
  "description": "WooCommerce"
}'

Public https:// address only (no localhost, private IP, credentials in the URL); stores limits deliveries to some of the workspace’s stores. An administrator can also declare the endpoint in Settings › API & Integrations › Webhooks and hand you the secret.

2. Verify the signature

HTTP
POST /wp-json/quoshop/v1/webhook HTTP/1.1
Content-Type: application/json; charset=utf-8
X-QuoShop-Event: inventory.updated
X-QuoShop-Delivery: evt_2b7f3c9d4e5a6b7c8d9e0f1a
X-QuoShop-Signature: t=1759482900,v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd

v1 = HMAC-SHA256(secret, "{t}.{raw body}"), in hexadecimal. Verify on the raw body, byte for byte, before any JSON decoding; refuse a t more than 300 s away from your clock (replay protection); compare in constant time to each v1 (there are two during a secret rotation).

function quoshop_verify(string $payload, string $header, string $secret, int $tolerance = 300): bool
{
    $t = null;
    $signatures = [];
    foreach (explode(',', $header) as $part) {
        [$key, $value] = array_pad(explode('=', trim($part), 2), 2, '');
        if ($key === 't' && ctype_digit($value)) {
            $t = (int) $value;
        } elseif ($key === 'v1') {
            $signatures[] = $value;
        }
    }
    if ($t === null || !$signatures || abs(time() - $t) > $tolerance) {
        return false;
    }
    $expected = hash_hmac('sha256', $t . '.' . $payload, $secret);
    foreach ($signatures as $signature) {
        if (hash_equals($expected, $signature)) {
            return true;
        }
    }
    return false;
}

$payload = file_get_contents('php://input'); // the raw body
if (!quoshop_verify($payload, $_SERVER['HTTP_X_QUOSHOP_SIGNATURE'] ?? '', getenv('QUOSHOP_WEBHOOK_SECRET'))) {
    http_response_code(401);
    exit;
}

The plugins’ PHP SDK provides the same check, tested against deliveries signed by the platform itself: QuoShop\Sdk\Webhook\SignatureVerifier.

3. Answer fast, deduplicate, process later

  1. Record the event — with a unique index on id (evt_…, also in X-QuoShop-Delivery): an event can arrive more than once (retry, manual redelivery), the index keeps one;
  2. answer 2xx within 10 seconds;
  3. process afterwards, in the background.

Any other status, a timeout or a refused connection is a failure: retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h. 410 Gone disables the endpoint at once.

4. Apply without going backwards

Arrival order is not guaranteed: an order.status_changed can come before the order.created a retry delayed. Before applying, compare with what you already applied:

EventGuard
order.*, product.*ignore if data.updatedAt is older than the version already applied
inventory.updatedignore if data.asOf is older

And ignore the types you do not know: adding an event is a compatible evolution of v1.

5. Test, monitor, catch up

  • POST /webhooks/endpoints/{id}/test sends a signed webhook.ping and returns your server’s response.
  • GET /webhooks/deliveries?status=FAILED,RETRYING: the log (30 days); POST /webhooks/deliveries/{id}/redeliver sends an event again once your receiver is fixed.
  • After a long outage, catch up with updatedSince (orders, products) and a full stock pass.