UCP Webhook Events, Cryptographic Signatures (RFC 9421 / HMAC) & Idempotency Spec — architecture reference visual

UCP Webhook Events, Cryptographic Signatures (RFC 9421 / HMAC) & Idempotency Spec

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.

REFERENCE EDITION · 2-PAGE PDF BRIEF · MARKDOWN TWIN
UCP Webhook Events & Idempotency — Reference Brief & Machine-Readable Twin
Print-ready 2-page reference summary (HTML tables and primary-source links) plus an ungated LF Markdown agent twin for AI assistants.
Download 2-Page Reference Brief (PDF)Markdown Agent Twin (.md)

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 NameTriggering TransitionRequired Merchant Handler ActionIdempotency Scope
ucp.checkout.session.authorizedAgent mandate + payment token authorizedReserve inventory & emit order_idsession_id + event_id
ucp.order.payment.capturedSettlement confirmed by payment handlerTransition order to fulfillable statepayment_intent_id + event_id
ucp.order.fulfillment.updatedCarrier tracking / shipment milestoneSync buyer & agent order statusfulfillment_id + event_seq
ucp.order.refund.settledPartial or full refund finalizedPost credit ledger entry & restockrefund_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)

ControlSpecification StandardFailure / Rejection Response
1. Raw-Body SignatureVerify HMAC-SHA256 (RFC 2104) or RFC 9421 over unparsed bytesHTTP 401 Unauthorized (log sig_mismatch)
2. Replay WindowReject signed timestamps older than 300 secondsHTTP 401 Unauthorized (clock skew guard)
3. Idempotent DedupePersist event_id / Idempotency-Key in atomic DB unique indexReturn HTTP 200 OK (no-op on duplicate)
4. Fast Enqueue AckVerify + enqueue asynchronously before heavy ERP callsTarget < 1,500ms HTTP 200/202 ACK
5. Exponential BackoffRetry 429/5xx with jittered backoff + Dead Letter QueueAlert 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

Related Hub Guides

Editorial & Regulatory Notice
Published by Universal Commerce Protocol (theuniversalcommerceprotocol.com) for educational and operational planning reference only; does not constitute legal, tax, insurance, accounting, or licensed engineering advice. Verify current statutory text and local Authority Having Jurisdiction (AHJ) rules before implementation.

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *