fix(rest/nodejs): deliver the order object as the webhook body#146
Merged
damaz91 merged 1 commit intoJul 24, 2026
Merged
Conversation
Mirrors Universal-Commerce-Protocol#140 (the Python fix): the orderEvent webhook body must be an order object (rest.openapi.json $ref: order), but the Node.js server posted a custom {event_type, checkout_id, order} envelope, and posted it even with no order. Post the order object as the body, carry the event type in an X-Event-Type header, and skip delivery when there is no order. Adds a test that captures the delivered webhook request and asserts the body is the bare order with the event type in the header.
damaz91
reviewed
Jul 24, 2026
Contributor
There was a problem hiding this comment.
The changes look good and align the Node.js implementation with the Python fix in #140 by delivering the bare order object as the webhook body and carrying the event type in the X-Event-Type header. Tests look good and pass.
Note: The current UCP specification requires Webhook-Timestamp and Webhook-Id headers for the orderEvent webhook. Neither the Python nor this Node.js implementation currently sends these headers. Opened a separate issue to track adding these spec-mandated headers to both implementations (#147).
damaz91
approved these changes
Jul 24, 2026
ptiper
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirrors #140 (now merged) on the Node.js side.
What
The
orderEventwebhook body must be an order object (rest.openapi.json→{"$ref": "order"}), but the Node.js server posted a custom envelope{ event_type, checkout_id, order }(rest/nodejs/src/api/checkout.ts), andposted it even when there was no order.
This posts the order object as the JSON body, carries the event type in an
X-Event-Typeheader, and skips delivery when there is no order — identical tothe fix merged for the Python server in #140.
Test
Adds
rest/nodejs/test/webhook.test.ts(node:test, no new deps): stubs theoutbound
fetchto capture the delivered request and asserts the body is thebare order (all required order fields, no
event_type/nested-orderenvelopekeys), the event type is in
X-Event-Type, and there is no delivery when thecheckout has no order. Fails on the old envelope, passes on the fix.
Verification
npm ciclean,npm run build(tsc) 0 errors,npm test7 passed (5existing + 2 new), pre-commit clean.