Skip to content

feat(cart): Embedded protocol transport binding for cart capability + reauth mechanism in ECP#244

Draft
jingyli wants to merge 3 commits intoUniversal-Commerce-Protocol:mainfrom
jingyli:clean-cart-embedded
Draft

feat(cart): Embedded protocol transport binding for cart capability + reauth mechanism in ECP#244
jingyli wants to merge 3 commits intoUniversal-Commerce-Protocol:mainfrom
jingyli:clean-cart-embedded

Conversation

@jingyli
Copy link
Contributor

@jingyli jingyli commented Mar 7, 2026

Reopening the PR to keep commit history clean (original PR) and hopefully third-time is the charm. This will also cross-reference/carry-over comments from the old PR.

Summary

Cart capability (dev.ucp.shopping.cart) is being introduced in #73. This adds an additional transport binding (EP) on the capability (building directly upon the referenced PR), on top of existing REST & MCP bindings. It follows the main UCP principle that "Embedded bindings should retain symmetry regardless of the capability it’s implemented for" (and hence why certain special mechanisms like auth are also being introduce to ECP to maintain symmetry).

Motivation

Businesses need a way to embed their cart building UI into eligible platforms, especially when complex experiences (i.e. item recommendations & upsells) are involved during cart building. Embedded Cart Protocol (ECaP) addresses this need.

Goals

  • Enable businesses to embed cart UI into eligible hosts in a secure manner, especially if identity linking is a required pre-requisite for the flow.
  • Establish a new auth exchange mechanism for embedded transport binding that utilizes postMessage mechanisms.
  • Maintain general schema & design consistency with existing ECP (i.e. reuse naming conventions, message types, etc.).
  • Introduce a way for businesses to advertise exactly for which capability is EP active for.

Non-Goals

Detailed Design

Key methods supported by ECaP:

Category Communication Direction Purpose Pattern Core Messages
Handshake Embedded Cart -> Host Establish connection between host and Embedded Cart. Request ect.ready
Authentication Embedded Cart -> Host Communicate auth data exchanges between Embedded Cart and host. Request ect.auth
Lifecycle Embedded Cart -> Host Inform of cart state in Embedded Cart. Notification ect.start, ect.complete
State Change Embedded Cart -> Host Inform of cart field changes. Notification ect.line_items.change, ect.buyer.change, ect.messages.change

Risks and Mitigations

  • Complexity: ECaP introduces another transport mechanism to implement & support. Mitigation: Not all businesses need to support it as part of its services advertisement. Also structurally it's also very similar to ECP so businesses already supporting ECP should be familiar with the design already.
  • Security: Introduced new request mechanism (ect.auth) to exchange required authorization data instead of adding them as query parameters in continue_url to avoid hijacking attacks & support reauth scenarios.
  • Backward Compatibility: None, new transport binding on a new capability.
  • Schema Drift: Not introducing any new schemas, only new methods that utilizes existing schema components.

Graduation Criteria

Working Draft → Candidate:

  • Schema merged and documented (with Working Draft disclaimer).
  • Unit and integration tests are passing.
  • Initial documentation is written.
  • TC majority vote to advance.

Candidate → Stable:

  • Adoption feedback has been collected and addressed.
  • Full documentation and migration guides are published.
  • TC majority vote to advance.

Implementation History

TBD

@igrigorik igrigorik added the TC review Ready for TC review label Mar 10, 2026
@igrigorik igrigorik added this to the Working Draft milestone Mar 10, 2026
Copy link
Contributor

@lemonmade lemonmade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few small nits and questions, but I am really liking how this has shaped up, especially the symmetry with Embedded Checkout 👍 This PR does still have one Cart-only message, ect.line_items.change_request; do we think this same feature makes sense in embedded checkout?

- **Result Payload:**
- `authorization` (string, **REQUIRED**): The requested authorization data,
can be in the form of an OAuth token, JWT, API keys, etc.
- `checkout` (object, **REQUIRED**): An optional checkout holding the last known state to the host.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? The embedded checkout should know the last checkout it sent before this message.

"id": "auth_1",
"method": "ec.auth",
"params": {
"type": "oauth"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the allowed types here?

- **Direction:** host → Embedded Checkout
- **Type:** Response
- **Result Payload:**
- `authorization` (string, **REQUIRED**): The requested authorization data,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, authorization reads a little weirdly for a message called ec.auth. What about using token here, or credential, which mirrors the name for a similar concept in payment instruments?

```

If the ingestion of the authorization is not successful, Embedded Checkout **MAY**
re-initiate this request with the host again.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we should how a Host would indicate failure, and what an Embedded Checkout should do with failures that come up?

in the cart interface. These are informational only. The cart has
already applied the changes and rendered the updated UI.

#### `ect.line_items.change`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are missing documentation for ect.line_items.change_request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TC review Ready for TC review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants