docs: document business-owned response values#519
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
87da12d to
be1335c
Compare
…_instruments)
Adds a response-only extension that surfaces the authenticated user's
saved payment instruments on cart and checkout responses under
`payment.saved_instruments[]`. Identity-gated by a new
`dev.ucp.shopping.saved_instruments:read` scope listed in
`identity_linking.config.scopes`. Mirrors the loyalty extension pattern.
Key design choices:
- Response-only (`ucp_request: omit`) — flows merchant → platform only
- No credential on the wire: schema enforces `"credential": { "not": {} }`.
Platforms select via `payment.instruments[].id`; the business mints a
checkout-bound TokenCredential per its declared payment handler.
- Per-instrument `default: true` flag instead of inferring from list order
- Business-scoped IDs; cross-merchant portability explicitly out of scope
be1335c to
3ff52fe
Compare
| * **Expiration awareness:** Surface "your saved card expires next month" | ||
| inline with cart/checkout. | ||
|
|
||
| A standalone capability that allows enumeration and management of saved |
|
Hi @raginpirate, @amithanda , wanted your opinion on the following, since I saw that you both have been actively contributing in this area of identity linking :) cc: @jamesandersen |
|
@karangoel16 thanks for raising this PR proposing a way for users to tap into one of the key benefits of "logging into" the business - accessing saved payment methods to reduce checkout friction! This is directly referenced as one of the possible benefits ("saved addresses and credentials") of the identity linking capability and #358 also raises a very similar proposal. With the recent identity linking updates in #354 landed, it feels like a good time to dig into the details for saved payment methods ... and potentially other checkout data as the docs allude to. A few initial comments here:
|
|
👍 You've got that exactly right @jamesandersen, saved instruments are already possible to surface back through UCP and that is intentional: same pattern for fulfillment, buyer, really all base entities of the protocol. And you bring up a secondary point about specifically how we consider simplifying saved entities in the UCP spec when the platform really does not require knowing how to handle the spec of the instrument to use it (its already got its credential). I don't think some saved instrument payment handler is the right direction: I think theres actually a greater, and simpler, abstraction that UCP is missing to denote any node in the tree as "tokenized" (a lot like our tokenized credential) and drop-in an id + description of what it is when the platform doesn't need to know its full spec context. @rosew, our lead on payments platform at Shopify, was actually working on an internal proposal of this problem as it matters a lot for us thinking about PII shared for these kinds of stored entities. Lets see if we can accelerate that! In the meantime, I do think this PR highlights that in general UCP does not document the mechanic of surfacing business-owned values rather than simply what the platform supplies. It could be worth repurposing this first PR to tackle that gap! |
7854804 to
dea0d34
Compare
|
@jamesandersen @raginpirate one protocol improvement surfaced while looking at the saved payment instrument example: Today
It may be worth adding an explicit enum in a future protocol revision, for example: "credential_state": "reference"with values like: ["reference", "required", "present"]That would make the saved instrument case clear without relying on opaque Please do let me know thoughts on the same ? |
Yep, trying to infer saved state from an id alone would certainly be a bad idea. Something explicit like a
...however, if I'm tracking @raginpirate accurately, I think he's prompting something that would be a bit more generic and thus applicable not only to credentials but also to other checkout PII that the business could surface to the platform in an identity-linked session
I look forward to this! |
Motivation
Review feedback clarified that saved instruments are already possible to surface through existing UCP response entities, especially
payment.instruments[]. The gap is that UCP does not clearly document the mechanic of businesses returning business-owned user state, rather than only echoing values supplied by the platform.This PR now repurposes the original saved-instruments proposal into a documentation clarification:
payment.instruments[]dev.ucp.shopping.saved_instrumentsextension is introducedProposal
Add a new docs page,
Business-Owned Response Values, explaining that UCP response objects may include values supplied by the business from its own user state when the request is user-authenticated through Identity Linking.The page includes:
payment.instruments[]Key design choices
payment.instruments[], not a newpayment.saved_instruments[]field.What this PR ships
docs/specification/business-owned-response-values.md— new docs page for business-owned response valuesdocs/specification/checkout.md— payment section links to the new guidancemkdocs.yml— nav/search entry for the new pagedocs/specification/saved-instruments.mdsource/schemas/shopping/saved_instruments.jsonSample shape
Business returns a saved payment method through existing
payment.instruments[]:{ "payment": { "instruments": [ { "id": "saved_shop_pay_4242", "handler_id": "shop_pay_1234", "type": "shop_pay", "selected": true, "display": { "description": "Saved Shop Pay account", "email": "buyer@example.com", "last_digits": "4242" } } ] } }The
idis an opaque business-owned reference for the authenticated user. The platform renders/selects it; the business verifies ownership and resolves it server-side.Follow-ups intentionally not in this PR
Category (Required)
Checklist
git diff --check; I did not run the full docs build locally.Discussion welcome on