Skip to content

[WIP] proposal: Payment Session Extensions for JSON-RPC 2.0 over WebSocket#212

Open
brendanjryan wants to merge 1 commit intomainfrom
brendan/websocket-transport-proposal
Open

[WIP] proposal: Payment Session Extensions for JSON-RPC 2.0 over WebSocket#212
brendanjryan wants to merge 1 commit intomainfrom
brendan/websocket-transport-proposal

Conversation

@brendanjryan
Copy link
Copy Markdown
Collaborator

@brendanjryan brendanjryan commented Mar 31, 2026

Summary

[WIP]

Defines how the session payment intent operates over WebSocket connections using JSON-RPC 2.0 frames. Extends draft-payment-transport-mcp-00 with session lifecycle messages.

Defines how the session payment intent operates over WebSocket
connections using JSON-RPC 2.0 frames. Extends draft-payment-transport-mcp-00
with session lifecycle messages (voucher, needVoucher, topUp, close).

Key design decisions:
- One session per connection, channelId-scoped
- payment.voucher as request with seq for correlation
- Control messages never metered, always processed while paused
- Challenge expires gates only open action
- Pre-upgrade 402 for connection-level payment
- Reconnect via highest-known voucher exchange
- Bidirectional metering deferred to future work
@brendanjryan brendanjryan changed the title proposal: Payment Session Extensions for JSON-RPC 2.0 over WebSocket [WIP] proposal: Payment Session Extensions for JSON-RPC 2.0 over WebSocket Mar 31, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d49753ebb7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +461 to +464
TopUp requires a valid challenge. If the original challenge has
expired, the client MUST obtain a fresh challenge by sending a
request that triggers a `-32042` error, then use that challenge
for the top-up credential.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Define credential carriage for payment.topUp

Section 4.5 makes payment.topUp depend on a valid challenge and even says clients must fetch a fresh challenge when expired, but the payment.topUp request shape in this spec only defines params fields and never defines where the required org.paymentauth/credential is sent. In WebSocket implementations this leaves a normative MUST that cannot be satisfied consistently, so different servers will either reject all top-ups or accept them without the intended challenge validation.

Useful? React with 👍 / 👎.

Comment on lines +265 to +266
remainder of the session. Voucher updates reference the original
`challengeId` for audit correlation but do not depend on
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove impossible challengeId requirement for vouchers

This text says voucher updates reference the original challengeId, but the payment.voucher schema later only includes channelId, cumulativeAmount, signature, and seq (no challengeId). That makes the stated correlation requirement unimplementable as written, and servers cannot rely on deterministic challenge-to-voucher attribution from voucher messages alone.

Useful? React with 👍 / 👎.

| `payment.close` | C→S | Request | No | Yes |
| `payment.needVoucher` | S→C | Notification | No | N/A (triggers pause) |
| `payment.receipt` | S→C | Notification | No | Yes |
| `payment.error` | S→C | Notification | No | Yes |
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Specify payment.error before listing it as supported

The message summary declares payment.error as a supported server notification, but the document never defines its payload, triggering conditions, or client handling rules. Leaving a listed control message undefined creates interoperability gaps because clients and servers cannot implement compatible behavior for this method.

Useful? React with 👍 / 👎.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant