Skip to content
Super CommerceSuperLabs
Documentation

Process commerce events securely, idempotently, and independently of delivery order.

Webhooks notify consumers that business state changed. A production receiver must verify authenticity, acknowledge quickly, tolerate duplicates and reordering, retry safely, and reconcile independently when completeness matters.

Implementation guide

Design for the successful path, the failure path, and production ownership.

01

Receive securely

Verify the raw body before processing the event.

  • Validate timestamp and signature against the endpoint secret
  • Reject events outside the replay window
  • Use constant-time signature comparison
  • Rotate signing secrets with an overlap period
02

Process reliably

Separate delivery acknowledgement from business work.

  • Persist the event identifier before returning success
  • Acknowledge quickly and process asynchronously
  • Deduplicate by event identifier
  • Do not assume delivery order across aggregate or event type
03

Recover completely

Use retries and reconciliation together.

  • Retry temporary failure with bounded backoff
  • Move exhausted attempts to an inspectable dead-letter flow
  • Provide controlled replay for resolved failures
  • Reconcile authoritative state on a defined schedule

Technical example

Verify before acknowledging

Use the pattern as a starting point and align URLs, schemas, scopes, timeouts, and error handling with the contract for your environment.

typescript
const rawBody = await request.text();
const signature = request.headers.get("x-sc-signature");
const timestamp = request.headers.get("x-sc-timestamp");

verifyWebhook({ rawBody, signature, timestamp, secret });
const event = JSON.parse(rawBody);

await eventStore.recordOnce(event.id, rawBody);
await queue.publish({ eventId: event.id });
return new Response(null, { status: 204 });

Production readiness

The integration is not complete until the team can operate it.

  1. 01

    Signature verification uses the unmodified raw request body

  2. 02

    Duplicate delivery produces one business outcome

  3. 03

    Slow processing happens after acknowledgement

  4. 04

    Replay and reconciliation have runbooks and owners

Technical evaluation

Prove the risky workflows before production commitment.

Bring the target architecture, representative contracts, volume profile, security requirements, failure cases, and operating responsibilities. We’ll define the smallest useful proof.

Book a technical session