Skip to content

[Feature/Roadmap] Let a buyer pick a payment rail for a resource #16

Open

Description

@SergeevDmitry

Depends on: the payment provider lifecycle contract, the move of rail handling into providers, and the mppx upgrade.

Context & Rationale

A resource's payments list orders the candidate rails. pickProvider() chooses the first with an enabled provider; the buyer cannot choose. The payment-required outcome exposes one requirement, and _payment is a bare string assigned to the resource's first method. Although x402 and MPP both ship, enabling both on a resource still exposes only one rail.

Proposed Changes

  • Give a payment-required outcome an optional list with one offer per enabled rail; payment keeps the first offer. HTTP sends PAYMENT-REQUIRED and WWW-Authenticate: Payment in one 402. An MCP tool result carries x402's PaymentRequired in structuredContent beside MPP's _meta["org.paymentauth/payment-required"].
  • Use each spec's carrier to select the rail: x402 and MPP headers on HTTP, their _meta keys on MCP, and the x402 extension on A2A. The buyer chooses by sending the corresponding proof.
  • Keep _payment a bare string. Each advertised rail says whether the string is in its format: an x402 proof is base64, and an MPP proof is a JSON credential starting with {, or Payment followed by the credential, with the scheme matched case-insensitively. Unless exactly one rail claims the string, reject the request before verification, with the challenges.
  • Answer a request that carries credentials for two rails with 400.
  • Reject an unknown, disabled, unadvertised or mismatched method before verification.
  • Honor MPP's optional Accept-Payment request header. Keep challenges matching a declared range with q>0, order them by the client's preference, and preserve server order for ties.
  • Bind the AP2 mandate to the selected amount, currency, rail, network, asset and destination.
  • Record the selected rail in the receipt and the transaction, and name it in config validation, discovery, doctor and errors.
  • Keep MPP challenges over MCP in the tool result's _meta. MCP 2026-07-28 forbids emitting -32042, the code the MPP MCP draft uses for a challenge. The support record lists the deviation.

Non-goals / Invariants Preserved

  • Fully additive: single-rail configs, the first-offer payment field and the bare _payment string keep working.
  • No fallback to another rail after settlement dispatch, and an unresolved purchase is never paid again on another rail.
  • Different amounts or assets are distinct offers. Exchange, split payment and smart routing are out of scope.
  • No rail's native challenge format changes.

Impact & Value

Done when buyers can see and choose among rails for one merchant capability, the selected rail appears in the transaction terms and receipt, and authorization and replay protection bind to that offer without merchant-backend changes.

Open question

For MCP and A2A, do we extend _payment into an object with method and proof, or add a sibling field and keep the string for x402 compatibility? The object with a compatibility shim is cleaner, but it touches the frozen contract surface.

Test plan

Use two deterministic providers. Select each rail through its own carrier on HTTP, MCP and A2A. Test _payment claimed by exactly one rail, neither rail and both rails. Credentials for both rails in one request return 400. Check Accept-Payment filtering and ordering, reject a proof for the other rail's offer, and test replay. An AP2 mandate for rail A must be rejected on rail B. Each purchase gets exactly one settlement and one backend call.

Activity

  1. added
    enhancement
    on Sep 17, 2026
  2. Revinand commented on Oct 21, 2026

    @Revinand
    Member

    For MCP and A2A, do we extend _payment into an object with method and proof, or add a sibling field and keep the string for x402 compatibility?

    Neither. _payment stays a bare string and the frozen contract does not change.

    Since this issue was opened, the gateway accepts each rail's spec carrier: _meta["x402/payment"] _meta["org.paymentauth/credential"] and on MCP, the x402 extension on A2A and separate headers on HTTP. Each carrier names its rail, so the buyer selects a rail by sending that rail's proof.

    _payment is our own carrier. It serves clients that can fill only tool arguments and it is the only way to pay an MPP skill over A2A, since MPP defines no A2A binding. Its format names the rail: an x402 proof is base64, with no space or {; an MPP proof is Payment ... or JSON starting with {. The gateway will route it by format rather than to the resource's first rail. If no advertised rail or more than one, claims the string, it is rejected before verification.

    Challenges are additive as well: a 402 can carry PAYMENT-REQUIRED and WWW-Authenticate: Payment together, an MCP tool result can carry both rails' challenges and the envelope gains an optional list of offers beside payment.

    A future rail with an overlapping format can use its own carrier; an optional _paymentMethod field can be added later without a break.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions