data.resource_url when that work needs the complete current resource.
Build the receiver
Your endpoint must follow this order:- Read the request body as raw bytes.
- Verify the timestamp and signature.
- Store the event with its
idas the idempotency key. - Return a
2xxstatus after durable storage. - Read the related resource outside the request path.
Verify the signature
The request contains three signature headers.
Remove the
whsec_ prefix from the secret, then decode the remaining value as Base64.
Join the webhook ID, timestamp, and raw body with full stops. Calculate HMAC-SHA256 and compare the Base64 result in constant time.
This complete Node.js function returns the parsed event only after verification.
Why signature verification fails
Why signature verification fails
Check that the receiver uses the raw body, the correct environment secret, and a timestamp in seconds. Keep the
whsec_ prefix in storage, but remove it before Base64 decoding.Process events in order
Webhook delivery is at least once. Delivery order can differ from event order. Deduplicate by eventid. Use data.order_sequence to order events for one order.
Use data.ordered_for to route an ordering-channel event. The value is null for a direct customer order.
Resolve data.resource_url and data.related_resource_urls against the origin in the event source.
Order events point to the order. Tracking, file, and inspection events point to their related resources.
Event types
An item event also reports the resulting order summary change. Bahn does not send an additional order status event for the same transition.
A cancellation event does not cause an additional order status event.