Machine Payments Protocol
MPP-NEAR implements the open standard for machine-to-machine payments. Enable HTTP 402 payments for your APIs and empower autonomous agents to transact automatically.Powered by OutLayer for gasless custody wallets.
Rust API
For Service Providers
Build payment-gated APIs with type-safe Rust primitives. Accept NEAR, USDC, and 100+ tokens automatically.
CLI Tools
For Agents & Clients
Empower AI agents, scripts, and automated systems to pay for services, swap tokens, and transact gaslessly. Build from source for full features.
What is MPP?
The Machine Payments Protocol (MPP) is an open standard for machine-to-machine payments that standardizes HTTP 402 "Payment Required" responses.
MPP-NEAR implements this protocol for the NEAR blockchain, allowing services to accept NEAR and NEP-141 tokens (USDC, USDT) as payment for API calls in a single HTTP request.
Request Protected Resource
Client accesses API endpoint requiring payment
Receive HTTP 402 Challenge
Server returns payment requirements in WWW-Authenticate header
Pay & Submit Credential
Client completes payment and retries with proof in Authorization header
Access Granted
Server verifies payment and returns requested resource
Why MPP-NEAR?
Enable machine-to-machine commerce without traditional payment friction
For Service Providers
Use the Rust API to build payment-gated APIs and monetize your services automatically with HTTP 402.
For Agents & Clients
Use the CLI to enable AI agents, scripts, and automated systems to pay for services gaslessly.
Near-Zero Fees
Pay ~$0.001 per transaction instead of 2.9% + $0.30 with traditional processors
Gasless Transactions
OutLayer handles all gas via NEAR Intents. No need to maintain NEAR for fees
20+ Blockchains
Swap and pay with tokens from NEAR, Ethereum, Bitcoin, Solana, and more via Intents
Stateless Security
HMAC binding lets you verify payments without database storage. Scale horizontally.
Instant Settlement
Payments settle in seconds, not days. No waiting for bank transfers or chargebacks
Open Standard
Implements MPP-1.0 specification. Interoperable with any MPP implementation
Features
Comprehensive toolkit for NEAR payments
Payments
- NEAR token payments
- NEP-141 token support (USDC, USDT, etc.)
- Gasless transfers via NEAR Intents
- Agent-to-agent payment checks
Protocol
- HTTP 402 standard implementation
- Challenge-response authentication
- Replay protection
- Payment verification
Developer Tools
- Rust SDK
- CLI tool for all operations
- Axum extractors
- Middleware for popular frameworks
Advanced
- Cross-chain swaps (20+ chains)
- Agent-to-agent payment checks
- Balance caching
- Configurable expiration
Quick Start
Get started with gasless NEAR payments in minutes
Install
Install the CLI tool with gasless payment support
cargo install mpp-near --features intentsRegister
Create a gasless custody wallet via OutLayer
mpp-near registerFund
Generate a link to deposit NEAR into your wallet
mpp-near fund-link --amount 0.1 --token nearPay
Send gasless payments to any NEAR account
mpp-near pay --recipient merchant.near --amount 1Rust API for Services
Build payment-gated APIs and monetize your services with type-safe Rust primitives. Accept NEAR payments for your API endpoints automatically.
Perfect For:
Create Payment Challenges
Generate HTTP 402 payment challenges when clients access your paid endpoints.
use mpp_near::{Challenge, RequestData};
let challenge = Challenge::builder()
.realm("api.example.com")
.method("near-intents")
.intent("charge")
.request(RequestData::new("0.001", "wallet.near"))
.secret(b"hmac-secret")
.build()?;Verify Payments Securely
Verify payment credentials with HMAC binding and challenge echo verification.
use mpp_near::Credential;
let credential = Credential::from_authorization(auth)?;
if credential.verify_challenge_echo(&challenge)
&& challenge.verify_binding(b"secret") {
// Payment valid - return requested data
}Stateless Verification
HMAC binding lets you verify payments without database storage. Scale horizontally without persistence.
Type-Safe API
Strongly typed builders catch errors at compile time, not runtime. Built for production services.
Standards Compliant
Implements MPP-1.0, RFC 9457, and RFC 9530 standards. Works with any MPP client.
CLI for Autonomous Agents
Command-line interface for AI agents, scripts, and automated systems to make payments, swap tokens, and interact with paid APIs automatically.
Perfect For:
Gasless Payments
Agents can pay for API access without managing gas. Powered by OutLayer custody wallets via NEAR Intents.
# Agent pays for API access
mpp-near pay \
--recipient api-provider.near \
--amount 0.001 \
--memo "API access - image generation"
# Pay with USDC (gasless!)
mpp-near pay \
--recipient merchant.near \
--amount 10 \
--token usdcAgent-to-Agent Payments
Create payment checks that other agents can claim. Perfect for agent commerce.
# Agent A creates payment check
mpp-near create-check \
--amount 50 \
--token usdc \
--memo "Data processing services" \
--expires-in 86400
# Agent B claims the payment
mpp-near claim-check \
--check-key <check_key_from_agent_a>Token Swaps
Agents can swap tokens across 20+ blockchains gaslessly
# Swap NEAR to USDC for payments
mpp-near swap --from near --to usdc --amount 1Balance Management
Monitor agent wallet balances automatically
# Check agent balance
mpp-near balance --api-key wk_...Payment Verification
Verify payments before proceeding with workflows
# Verify payment completed
mpp-near verify --tx-hash 0x123abc...Wallet Registration
Set up agent custody wallets for gasless operations
# Register agent wallet
mpp-near registerReady to Get Started?
Build from source to enable gasless payments for your AI agents.
git clone https://github.com/kampouse/mpp-near && cd mpp-near && cargo install --path . --features intentsPayment Providers
MPP-NEAR supports both standard NEAR transactions and gasless Intents
| Feature | Standard Provider | Intents Provider |
|---|---|---|
| Gasless Transactions | ❌ Requires NEAR for gas | ✅ Zero gas fees |
| Token Swaps | ❌ Not supported | ✅ 20+ chains |
| Cross-Chain | ❌ Limited to NEAR | ✅ Native bridges |
| Agent Payments | ❌ Storage required | ✅ Payment checks |
| Setup Complexity | High (key management) | Low (API key only) |
| Transaction Speed | ~1s (block time) | Instant (solver relay) |
When to Use Each
- • You need full control over keys
- • On-chain transactions required
- • No external dependencies
- • Gasless microtransactions
- • Cross-chain operations
- • Agent-to-agent payments