feat: add optional display_order to payment handlers#176
feat: add optional display_order to payment handlers#176prasad-stripe wants to merge 1 commit intoUniversal-Commerce-Protocol:mainfrom
Conversation
|
Gave feedback in the issue description, as higher-level alignment on the solution will help drive this PR shape ❤️ 🚀 |
Move display_order from handler level to available_instruments level per feedback on Universal-Commerce-Protocol#170. Ordering is suggestive and relative across all instruments across all handlers, allowing businesses to rank distinct payment paths independently (e.g., card via Google Pay before card via direct entry). Addresses Universal-Commerce-Protocol#170
ca0845f to
040e293
Compare
Thanks @raginpirate — great point about handlers not being 1:1 with payment methods. I've updated PR #176 to move display_order from the handler level to available_instruments. It's now an optional integer on available_payment_instrument.json, relative across all instruments across all handlers in the response. This handles both use cases: ordering funding sources (card before bank) and ordering distinct payment paths (card via Google Pay before card via direct entry). Kept it to a single layer (instruments only) to keep semantics simple — we can add handler-level ordering later if needed. Would appreciate another look on the PR when you get a chance. |
kmcduffie
left a comment
There was a problem hiding this comment.
@prasad-stripe Thanks for the PR! A few questions in line.
| user preference, localization, A/B tests, or other factors. | ||
| - Entries without `display_order` express no preference and **SHOULD** be | ||
| placed after entries that declare one. | ||
| - When multiple entries share the same `display_order` value, the platform |
There was a problem hiding this comment.
An alternative might be that the spec does not support duplicate values in a given payload.
I'd like to better understand the use case you're thinking of that's driving this modeling where there could be collisions?
| placed after entries that declare one. | ||
| - When multiple entries share the same `display_order` value, the platform | ||
| determines their relative order. | ||
| - `display_order` participates in the `available_instruments` resolution flow: |
There was a problem hiding this comment.
This field shares the same name as the first field in this comment. Did you mean for this to be different than the display_order above?
| }, | ||
| "display_order": { | ||
| "type": "integer", | ||
| "description": "Business-suggested display priority for this instrument across all handlers. Lower values indicate higher preference. Ordering is suggestive; platforms MAY override based on user preference, localization, or other factors.", |
There was a problem hiding this comment.
I don't believe a handler will know of any other handlers. Can the display_order be across all handlers, or is more signaling the priority within the instruments returned by this handler?
|
fwiw this PR is great @prasad-stripe, I got to catch @igrigorik async for a moment on this and I think there might be a higher level abstraction here for how we generally offer ordering hints across UCP for arrays... we're thinking about this and will circle back, if you don't also come up with something 😄 TLDR; seems like this isn't just a payments concern! |
|
Adding some thoughts for discussion to provide ordering hints for arrays within UCP objects (like available_instruments, line_items, totals, etc.) Option 1: Sibling _hints Object Option 2: In-Item _display Hints |
Payment handler display order (merchant-suggested ordering)
Description
Please include a summary of the changes and the related issue. Please also
include relevant motivation and context.
Adds an optional
display_orderfield to each payment handler inpayment_handlers. Businesses (merchants) can set an integer per handler(lower = higher preference) to suggest how payment methods should be ordered
when presented to the user. The ordering is suggestive only: platforms and
agents MAY reorder (e.g. for user preference, localization, or A/B tests). Addresses #170
This gives merchants a standard way to express their preferred order—e.g. for
fraud vs. conversion trade-offs—without requiring agents to follow it strictly.
Aligns with the same capability in the Agentic Commerce Protocol (ACP).
Type of change
Please delete options that are not relevant.
functionality to not work as expected, including removal of schema files
or fields)
Is this a Breaking Change or Removal?
N/A — optional additive field only.
Motivation and context
Today the ordering of payment methods on the platform or agent side is
unspecified. Merchants know what works best for their fraud/conversion
trade-off and should be able to suggest an order at the spec level.
Fixes/Addresses: #[issue number] (fill in the UCP issue number you created)
Example
Handler with
display_order:{ "id": "processor_tokenizer_1234", "version": "2026-01-11", "spec": "https://example.com/ucp/handler", "schema": "https://example.com/ucp/handler/schema.json", "config": { "environment": "production", "business_id": "business_xyz_789" }, "display_order": 0 }Lower
display_order= higher preference (e.g. show first). Omission means nosuggestion.
Checklist
Pull Request Title
Use Conventional Commits, e.g.:
feat: add optional display_order to payment handlersFiles changed
source/schemas/payment_handler.json— added optionaldisplay_order(integer) tobasedefinition.docs/specification/payment-handler-guide.md— addeddisplay_orderto Business Schema example and a short description of thefield.
Additional notes
unknown properties. No breaking changes.
a script that reads
source/schemas), re-run the generator sodisplay_orderappears in the generated types.keeps UCP and ACP aligned for merchant-suggested payment handler ordering.