-
Notifications
You must be signed in to change notification settings - Fork 377
feat: Add seamless checkout transition functionality to ECaP #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a640b8b
57ef459
b046e15
336f8e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -361,6 +361,8 @@ proceed to initiate a checkout session based on the completed cart by issuing a | |
| - **Type:** Notification | ||
| - **Payload:** | ||
| - `cart` (object, **REQUIRED**): The final state of the cart. | ||
| - `transition` (object, **OPTIONAL**): Advertisement for availability to transition | ||
| directly into Embedded Checkout. | ||
|
|
||
| **Example Message:** | ||
|
|
||
|
|
@@ -381,6 +383,59 @@ proceed to initiate a checkout session based on the completed cart by issuing a | |
| } | ||
| ``` | ||
|
|
||
| Business **MAY** also choose to specify a `transition` field to advertise a mechanism | ||
| for hosts to seamlessly transition into Embedded Checkout from the completed | ||
| Embedded Cart. This is represented by `transition` containing a minimal `checkout` object: | ||
|
|
||
| - `ucp` (object, **REQUIRED**): Metadata to fully qualify the advertisement. | ||
| Business **MUST** include a checkout capability and an embedded service binding | ||
| with `config.delegate`. | ||
| - `url` (string, **REQUIRED**): URL representing shift to checkout. Business **MUST** | ||
| specify a HTTPS URL and **MAY** choose a stateless URL like permalink. See | ||
| [Checkout Capability - Continue URL Format](checkout.md#format). | ||
|
|
||
| **Example Message With `transition`:** | ||
|
|
||
| ```json | ||
| { | ||
| "jsonrpc": "2.0", | ||
| "method": "ep.cart.complete", | ||
| "params": { | ||
| "cart": { ...cart fields... }, | ||
| "transition": { | ||
| "checkout": { | ||
| "ucp": { | ||
| "version": "{{ ucp_version }}", | ||
| "status": "success", | ||
| "capabilities": { | ||
| "dev.ucp.shopping.checkout": [ { "version": "{{ ucp_version }}" } ] | ||
| }, | ||
| "services": { | ||
| "dev.ucp.shopping": [ | ||
| { | ||
| "version": "{{ ucp_version }}", | ||
| "transport": "embedded", | ||
| "config": { | ||
| "delegate": [...] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "url": "https://merchant.example.com/cart-to-checkout/checkout123", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Recommendation: We should not rely on the URL for (checkout) identity disambiguation. While a merchant may bake an ID into the URL slug, that identity is opaque to the host's programmatic orchestration. To support agentic workflows and reliable logging, let's include the checkout id as an explicit field in the transition.checkout object (when known). This makes it slightly more explicit that there is a JIT variant too where the id isn't provided until
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would you be able to help me understand this argument a bit more? I actually feel like having an explicit
|
||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| When `transition` is received as part of `ep.cart.complete`, the host **MAY** choose | ||
| to initiate Embedded Checkout by appending `checkout.url` with relevant parameters - | ||
| see [Embedded Checkout - Loading an Embedded Checkout URL](embedded-checkout.md#loading-an-embedded-checkout-url). | ||
| Host also has full flexibility over how they want to render Embedded Checkout (i.e. | ||
| reuse the same embedded context as Embedded Cart or tear down the current one in favour | ||
| of bootstrapping a new embedded context). | ||
|
|
||
| ### State Change Messages | ||
|
|
||
| State change notifications follow the shared EP pattern — see | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -496,6 +496,29 @@ | |
| "$ref": "../../schemas/shopping/cart.json", | ||
| "description": "Final cart state." | ||
| } | ||
| }, | ||
| { | ||
| "name": "transition", | ||
| "schema": { | ||
| "type": "object", | ||
| "description": "Optional advertisement from business for seamless transition from cart to checkout.", | ||
| "required": ["checkout"], | ||
| "properties": { | ||
| "checkout": { | ||
| "type": "object", | ||
| "description": "Metadata required by the host to bootstrap and transition into an embedded checkout session.", | ||
| "required": ["ucp", "url"], | ||
| "properties": { | ||
| "ucp": { "$ref": "#/components/schemas/ucp_success" }, | ||
| "url": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While a generic uri format permits http://, allowing an unencrypted handoff at the cart-to-checkout inflection point is something we should avoid. It leaves session parameters and any delegated authority contexts wide open to interception. One solution would be to introduce a reusable Any thoughts? Doesn't need to be part of this PR, I can create a standalone proposal.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a couple of places in UCP today that emphasize the use of
I tightened the language of |
||
| "type": "string", | ||
|
jingyli marked this conversation as resolved.
|
||
| "format": "uri", | ||
| "description": "The transition URL." | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| }, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.