MPP on Stellar
What is MPP?
The Machine Payments Protocol (MPP) is an open protocol that enables programmatic, per-request payments over HTTP, designed especially for AI agents and APIs. It extends the 402 Payment Required HTTP status code into a machine-readable payment negotiation layer for both humans and autonomous agents.
On Stellar, MPP works with Soroban SAC (Stellar Asset Contract) token transfers so that clients can pay for API requests natively, without an external facilitator. This makes it ideal for micropayments, AI agent-driven APIs, and payment-enabled applications.
Supported MPP Intents
The @stellar/mpp SDK supports two payment intents:
Charge
Immediate one-time payments. Each request triggers a Soroban SAC transfer settled on-chain individually. This is the simplest intent — no channel setup or pre-funding required.
Two credential modes are available:
- Pull (default) — The client prepares and signs the Soroban authorization entries; the server broadcasts the transaction. Supports an optional sponsored path where the server rebuilds the transaction with its own account as source, so the client never pays network fees.
- Push — The client broadcasts the transaction itself and sends the transaction hash for server verification.
See the MPP Charge Guide to get started.
Session
The session intent enables high-frequency, pay-as-you-go payments over unidirectional payment channels. The funder deposits tokens into the channel once, then makes many off-chain payments by signing cumulative commitments — no per-payment on-chain transactions, ideal for AI agent interactions. The server settles by closing the channel when convenient.
See the MPP Session Guide to get started.
Demo
Try the live demo at mpp.stellar.buzz, or run the MPP Demo locally. It runs a Node.js server that charges 0.01 USDC per request and a minimal browser UI for testing end-to-end payment flows on Stellar Testnet.
To build an MPP-enabled service or integrate payments into your app, see Build Applications and the resources below.
Install
npm install @stellar/mpp mppx @stellar/stellar-sdk
Examples
- @stellar/mpp (GitHub) — SDK source code, examples, and integration tests. View on GitHub
- Server example — A minimal Node.js HTTP server charging 0.01 USDC per request using
@stellar/mpp/charge/server. View on GitHub - Client example — A Node.js client that automatically handles 402 responses using
@stellar/mpp/charge/client. View on GitHub
Learn more
- MPP Specification — Official MPP protocol specification
- @stellar/mpp (npm) — npm package for MPP on Stellar
- mppx (npm) — Core MPP framework library
- one-way-channel contract — Soroban contract powering channel mode
- Signing Soroban invocations — Auth-entry signing and transaction signing on Stellar