Skip to content

fix(rest/nodejs): stop copying client supplied omit members into the checkout response - #193

Merged
carolinerg1 merged 1 commit into
Universal-Commerce-Protocol:mainfrom
vishkaty:fix/checkout-omit-fields
Aug 20, 2026
Merged

fix(rest/nodejs): stop copying client supplied omit members into the checkout response#193
carolinerg1 merged 1 commit into
Universal-Commerce-Protocol:mainfrom
vishkaty:fix/checkout-omit-fields

Conversation

@vishkaty

Copy link
Copy Markdown
Contributor

What

The create handler builds the response by spreading the request body over the explicit keys. checkout.json marks continue_url, expires_at, messages and order as ucp_request omit, and none of the four has an explicit key, so a request carrying one sees its value come back in the 201 and persist into the stored session:

POST /checkout-sessions
{"line_items": [{"item": {"id": "bouquet_roses"}, "quantity": 1}],
 "continue_url": "https://platform.example/client-chosen",
 "expires_at": "2030-01-01T00:00:00Z"}

HTTP 201
response.continue_url = "https://platform.example/client-chosen"
response.expires_at   = "2030-01-01T00:00:00Z"

and a later GET returns the same values. messages behaves the same way, and so does order: a request carrying a fabricated order object, id and permalink included, sees it come back in the 201 and persist. ucp, id, status, totals, links and currency are unaffected because explicit keys already overwrite them, which is the negative control.

Fix

The destructuring that already drops fulfillment before the spread now also drops continue_url, expires_at, messages and order, so every ucp_request omit member gets the same treatment the explicit keys give the rest.

Testing

…checkout response

The create handler builds the response by spreading the request body over
the explicit keys. checkout.json marks continue_url, expires_at, messages
and order as ucp_request omit, and none of the four has an explicit key,
so a request that carried one saw its value come back in the 201 and
persist into the stored session. The spread now drops all four, matching
the handling the explicit keys already give ucp, id, status, totals, links
and currency. Same defect class as the currency read fixed in Universal-Commerce-Protocol#156 and the
id fixed in Universal-Commerce-Protocol#167 on the Python server.
@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Aug 20, 2026
@damaz91 damaz91 added status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 20, 2026
@carolinerg1
carolinerg1 merged commit accfe4e into Universal-Commerce-Protocol:main Aug 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants