Skip to content

feat: add MPP payment layer#3835

Closed
stevencartavia wants to merge 5 commits intoalloy-rs:mainfrom
stevencartavia:mpp-layer
Closed

feat: add MPP payment layer#3835
stevencartavia wants to merge 5 commits intoalloy-rs:mainfrom
stevencartavia:mpp-layer

Conversation

@stevencartavia
Copy link
Copy Markdown
Contributor

@stevencartavia stevencartavia commented Mar 25, 2026

Adds MPP 402 payment handling to alloy's HTTP and WS transports.

  • MppLayer<P> + MppService<S,P> — tower middleware that intercepts 402 responses, pays, and retries
  • MppReqwestClient<P> — reqwest transport with 402 interception
  • MppWsConnect<P> — wraps WsConnect, handles 402 during WS upgrade

Adds MPP 402 payment handling to alloy's HTTP and WS transports.

- MppLayer<P> + MppService<S,P> — tower middleware for hyper that intercepts
  402 responses, parses the Payment challenge, calls provider.pay(), and
  retries with an Authorization header
- MppReqwestClient<P> — reqwest transport with built-in 402 interception
- MppWsConnect<P> — wraps WsConnect, handles 402 during WS upgrade handshake
- mpp-tempo feature adds with_tempo_signer / with_tempo_access_key convenience
  constructors on all three types

Amp-Thread-ID: https://ampcode.com/threads/T-019d2306-2d81-77e8-84af-41a35f908648
Co-authored-by: Amp <amp@ampcode.com>
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

@onbjerg do we want this here or should all of this live in the mpp crate?

imo having this here will be a pita to maintain because we kinda have a cyclical dep via tempo-alloy here

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants