mpp
Rust SDK for the Machine Payments Protocol
MPP lets any client — agents, apps, or humans — pay for any service in the same HTTP request. It standardizes HTTP 402 with an open IETF specification, so servers can charge and clients can pay without API keys, billing accounts, or checkout flows.
You can get started today by reading the Rust SDK docs, exploring the protocol overview, or jumping straight to the quickstart.
Install
Quick Start
Server (Tempo)
use ;
let mpp = create?;
let challenge = mpp.charge?;
let receipt = mpp.verify_credential.await?;
Server (Stripe)
use ;
let mpp = create_stripe?;
let challenge = mpp.stripe_charge?;
let receipt = mpp.verify_credential.await?;
Client (Tempo)
use ;
use ClientBuilder;
let provider = new?;
let client = new
.with
.build;
// Requests now handle 402 automatically
let resp = client.get.send.await?;
Client (Stripe)
use ;
use CreateTokenResult;
let provider = new;
let resp = new
.get
.send_with_payment
.await?;
Feature Flags
| Feature | Description |
|---|---|
client |
Client-side payment providers (PaymentProvider trait, Fetch extension) |
server |
Server-side payment verification (ChargeMethod trait) |
tempo |
Tempo blockchain support (includes evm) |
stripe |
Stripe payment support via SPTs |
evm |
Shared EVM utilities (Address, U256, parsing) |
middleware |
reqwest-middleware support with PaymentMiddleware (implies client) |
tower |
Tower middleware for server-side integration |
axum |
Axum extractor support for server-side convenience |
utils |
Hex/random utilities for development and testing |
Payment Methods
MPP supports multiple payment methods through one protocol — Tempo, Stripe, Lightning, Card, and custom methods. The server advertises which methods it accepts, and the client chooses which one to pay with. This SDK implements Tempo (charge and session intents) and Stripe (charge intent via Shared Payment Tokens).
Protocol
Built on the "Payment" HTTP Authentication Scheme, an open specification proposed to the IETF. See mpp.dev/protocol for the full protocol overview, or the IETF specification for the wire format.
Contributing
git clone https://github.com/tempoxyz/mpp-rs
cd mpp-rs
cargo test
Security
See SECURITY.md for reporting vulnerabilities.
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in these crates by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.