Receiving webhooks
Create a subscription with POST /merchants/me/webhooks, pointing at an HTTPS endpoint you control. Stow Cards POSTs one JSON envelope per event, with these headers:
| Header | Value |
|---|
X-Stow-Webhook-Event | the event type, e.g. points.changed |
X-Stow-Webhook-Timestamp | ISO-8601 timestamp of the delivery attempt |
X-Stow-Webhook-Subscription | the subscription id |
X-Stow-Webhook-Signature | sha256= + HMAC-SHA256 signature (present when the subscription has a secret) |
User-Agent | stow-cards-webhook/1.0 |
Respond with any 2xx within the subscription's timeoutMs. Non-2xx or timeouts are retried up to retryPolicy.maxAttempts with backoffMs between attempts. Deliveries (payload, status, attempts) are inspectable at GET /merchants/me/webhooks/delivery-logs, and any logged delivery can be re-sent with POST /merchants/me/webhooks/delivery-logs/{logId}/replay.
Idempotency on your side: deliveries are at-least-once. Dedupe on eventId: it identifies one occurrence of the event, and retries and replays of that occurrence reuse it. A new occurrence gets a new eventId, even when it looks the same: a customer who removes a pass and adds it again on the same phone produces a second pass.installed with its own eventId.
Verifying the signature
The signature is HMAC-SHA256(secret, "{timestamp}.{rawBody}"), hex-encoded, prefixed with sha256=. The {timestamp} is the value of the X-Stow-Webhook-Timestamp header. Checking it also protects you from replays (reject deliveries older than, say, 5 minutes).
Node.js
import crypto from 'node:crypto';
function verifyStowWebhook(req, secret, toleranceMs = 5 * 60 * 1000) {
const timestamp = req.headers['x-stow-webhook-timestamp'];
const received = req.headers['x-stow-webhook-signature'] || '';
if (!timestamp || !received.startsWith('sha256=')) return false;
if (Math.abs(Date.now() - Date.parse(timestamp)) > toleranceMs) return false;
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${req.rawBody}`) // rawBody: the exact bytes received
.digest('hex');
// timingSafeEqual throws on buffers of different lengths, so check first.
if (Buffer.byteLength(received) !== Buffer.byteLength(expected)) return false;
return crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
}
Python
import hashlib, hmac, time
from datetime import datetime, timezone
def verify_stow_webhook(headers, raw_body: bytes, secret: str, tolerance_s=300):
timestamp = headers.get("X-Stow-Webhook-Timestamp", "")
received = headers.get("X-Stow-Webhook-Signature", "")
if not timestamp or not received.startswith("sha256="):
return False
sent = datetime.fromisoformat(timestamp.replace("Z", "+00:00"))
if abs(time.time() - sent.timestamp()) > tolerance_s:
return False
expected = "sha256=" + hmac.new(
secret.encode(), f"{timestamp}.".encode() + raw_body, hashlib.sha256
).hexdigest()
return hmac.compare_digest(received, expected)
Compute the HMAC over the raw request bytes, not a re-serialized JSON object, because key order matters.
Choosing events
Subscribe to specific events or * for every event documented here (and any added later); every delivery carries data. Test any subscription with POST /merchants/me/webhooks/{id}/test. It queues a real, signed delivery named after the subscription's first event type other than * (member.updated for a *-only subscription), but its data is only { "test": true, "subscriptionId": "…", "sentAt": "…" }, never that event's fields. Check data.test before reading event fields.
Rotating the secret
POST /merchants/me/webhooks/{id}/rotate-secret takes effect at once: new deliveries are signed with the new secret, and your receiver rejects them until it has it. Keep that window short (have the receiver read its secrets from a store you update straight after rotating), accept both secrets in the meantime (retries signed before the rotation still carry the old one), then resend anything that failed with GET /merchants/me/webhooks/delivery-logs?success=false and POST /merchants/me/webhooks/delivery-logs/{logId}/replay.