Updated December 1, 2026.
Direct Answer: Universal Commerce Protocol (UCP) webhook consumers must verify every inbound event payload using raw-body HMAC-SHA256 (RFC 2104) or HTTP Message Signatures (RFC 9421), enforce a <= 300-second timestamp replay window, and deduplicate retried deliveries via unique event_id and Idempotency-Key state locks before triggering fulfillment or ledger mutations.
Developers and merchant integration teams hitting /docs/api/webhooks/events/ need one authoritative reference for async order-state callbacks. Because agentic checkout pipelines retry aggressively on transient network timeouts, unverified or non-idempotent webhook handlers risk double-fulfilling orders or accepting spoofed settlement events.
Core UCP Webhook Event Types & State Transitions
| Event Name | Triggering Transition | Required Merchant Handler Action | Idempotency Scope |
|---|---|---|---|
| ucp.checkout.session.authorized | Agent mandate + payment token authorized | Reserve inventory & emit order_id | session_id + event_id |
| ucp.order.payment.captured | Settlement confirmed by payment handler | Transition order to fulfillable state | payment_intent_id + event_id |
| ucp.order.fulfillment.updated | Carrier tracking / shipment milestone | Sync buyer & agent order status | fulfillment_id + event_seq |
| ucp.order.refund.settled | Partial or full refund finalized | Post credit ledger entry & restock | refund_id + event_id |
Standard UCP Webhook Event Envelope & Header Contract
Every UCP webhook POST delivers UTF-8 JSON containing event_id, event_type, occurred_at (RFC 3339 UTC), ucp_version, merchant_id, and data payload alongside cryptographic verification headers (Signature-Input / Signature under RFC 9421 or X-UCP-Signature-256) plus an Idempotency-Key header matching IETF HTTPAPI semantics.
Raw-Byte Signature Verification & Replay Protection
Never serialize parsed JSON back to strings before verifying HMAC-SHA256 or Ed25519 signatures: whitespace, key ordering, and float formatting alter hashes and break valid signatures. Compute digests strictly against raw HTTP request body bytes concatenated with the signed timestamp, and reject requests outside a +/- 300-second window using constant-time comparison.
Webhook Verification & Retry Contract (5 Non-Negotiable Rules)
| Control | Specification Standard | Failure / Rejection Response |
|---|---|---|
| 1. Raw-Body Signature | Verify HMAC-SHA256 (RFC 2104) or RFC 9421 over unparsed bytes | HTTP 401 Unauthorized (log sig_mismatch) |
| 2. Replay Window | Reject signed timestamps older than 300 seconds | HTTP 401 Unauthorized (clock skew guard) |
| 3. Idempotent Dedupe | Persist event_id / Idempotency-Key in atomic DB unique index | Return HTTP 200 OK (no-op on duplicate) |
| 4. Fast Enqueue Ack | Verify + enqueue asynchronously before heavy ERP calls | Target < 1,500ms HTTP 200/202 ACK |
| 5. Exponential Backoff | Retry 429/5xx with jittered backoff + Dead Letter Queue | Alert ops after max retry window |
Atomic Idempotency & Retry Safety in Merchant Backends
Network drops between merchant processing and HTTP response transmission guarantee at-least-once delivery. Inserting event_id into a transactional unique-key table inside the same database transaction as the order-state update ensures duplicate deliveries safely return HTTP 200 without double-shipping goods or double-crediting refunds.
Frequently Asked Questions
Why should webhook handlers return HTTP 200 before calling downstream ERP or shipping APIs?
If a downstream ERP takes 12 seconds to respond, the webhook sender may time out and retry, creating concurrent duplicate deliveries. Verifying signatures, committing event_id, and enqueueing work locally returns HTTP 200 in under 200ms.
Should UCP integrations support both HMAC-SHA256 and RFC 9421 HTTP Message Signatures?
Yes. Symmetric HMAC-SHA256 (RFC 2104) remains universal for merchant-to-gateway webhooks, while asymmetric Ed25519 HTTP Message Signatures (RFC 9421) enable public-key verification across multi-party agentic networks.
Primary Verification Sources
- RFC 9421 — HTTP Message Signatures
- RFC 2104 — HMAC: Keyed-Hashing for Message Authentication
- IETF HTTPAPI Idempotency-Key Header Specification
Related Hub Guides
- UCP Developer Integration Guides Hub
- MCP Deep Dive: Connecting LLM Tools to UCP Transactional Schemas

Leave a Reply