Skip to content

tempoxyz/mpp-rs



Machine Payments Protocol



mpp

Rust SDK for the Machine Payments Protocol

Website Docs Crates.io License

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

cargo add mpp

Quick Start

Server

use mpp::server::{Mpp, tempo, TempoConfig};

let mpp = Mpp::create(tempo(TempoConfig {
    recipient: "0x742d35Cc6634C0532925a3b844Bc9e7595f1B0F2",
}))?;

let challenge = mpp.charge("1")?;
let receipt = mpp.verify_credential(&credential).await?;

Client

use mpp::client::{PaymentMiddleware, TempoProvider};
use reqwest_middleware::ClientBuilder;

let provider = TempoProvider::new(signer, "https://rpc.moderato.tempo.xyz")?;
let client = ClientBuilder::new(reqwest::Client::new())
    .with(PaymentMiddleware::new(provider))
    .build();

// Requests now handle 402 automatically
let resp = client.get("https://mpp.dev/api/ping/paid").send().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)
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 currently implements Tempo (charge and session intents).

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.

About

Rust SDK for the Machine Payments Protocol

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors