An open-source, self-hosted x402 payment facilitator for AI agents and autonomous systems.
Features • Quick Start • Documentation • Platform • Contributing
ZeroPay is a lightweight, self-hosted x402 payment facilitator built with Rust. It enables AI agents and autonomous systems to programmatically discover, authorize, and settle stablecoin payments using EIP-3009 gasless transfers — with no manual wallet management or blockchain infrastructure required.
- x402 Protocol: Full Agent-to-Agent (A2A) payment protocol for autonomous AI integrations
- Gasless Payments: EIP-3009
transferWithAuthorization— payer signs off-chain, payee covers gas - Instant Settlement: No waiting for blockchain confirmation; payment settles in one transaction
- Secure: EIP-712 typed signatures with time-bound authorization windows
- Discoverable: Agents can browse available services via
/x402/discovery - Multi-Chain: Ethereum, Polygon, Base, and other EVM-compatible networks
- Stablecoin Focused: USDC, USDT, and other EIP-3009 compatible tokens
- EIP-8004 Support: Optional agent reputation and identity registry integration
- Self-Hosted: Full control over your payment infrastructure
- Docker Ready: One-command deployment
-
Configure your settings in
docker-compose.yml:environment: - MNEMONICS=your twelve or twenty four word mnemonic phrase - WALLET=0xYourWalletAddress - APIKEY=your-secure-api-key
-
Configure blockchain in
config.toml:[[chains]] chain_type = "evm" chain_name = "base-sepolia" latency = 1 estimation = 12 commission = 5 commission_min = 50 commission_max = 200 admin = "0xYourAdminPrivateKey" rpc = "https://base-sepolia.g.alchemy.com/v2/YOUR-API-KEY" tokens = ["USDC:0xYourUSDCAddress:2"]
The
:2suffix marks a token as x402-compatible (EIP-3009). -
Start all services:
docker-compose up -d
-
Verify x402 support:
curl "http://localhost:9000/x402/support?apikey=your-api-key"
See DEPLOYMENT.md for detailed setup instructions.
- Deployment Guide - Complete setup for Docker and source builds
- API Reference - x402 REST API endpoints and usage examples
- x402 Protocol Guide - Protocol overview and integration details
- AI Integration Guide - Complete guide for AI agents integrating with ZeroPay
┌─────────────────────────────────────────────────────┐
│ AI Agent │
│ │
│ 1. GET /x402/requirements → discover payee addr │
│ 2. Sign EIP-712 authorization off-chain │
│ 3. POST /x402/payments → settle on-chain │
│ 4. Receive tx hash + confirmation │
└─────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ ZeroPay API │
│ │
│ /x402/requirements — payment requirements │
│ /x402/payments — verify + settle │
│ /x402/support — supported schemes │
│ /x402/discovery — browse available services │
└───────────────────────┬─────────────────────────────┘
│ transferWithAuthorization
▼
┌─────────────────────────────────────────────────────┐
│ Blockchain (EVM) │
│ EIP-3009 gasless token transfer │
└─────────────────────────────────────────────────────┘
Payment flow:
- Agent calls
GET /x402/requirementswithcustomer+amount→ gets a payee address and accepted payment schemes - Agent creates an EIP-712 signature authorizing the transfer (off-chain, gasless for payer)
- Agent calls
POST /x402/paymentswith the signed authorization - ZeroPay verifies the signature and executes
transferWithAuthorizationon-chain - Returns transaction hash to the agent
zeropay/
├── api/ # REST API server (Axum)
├── scanner/ # Chain scanner + x402 asset initialization
├── x402/ # x402 protocol types, facilitator, client SDK
├── config.toml # Chain and token configuration
├── Dockerfile
└── docker-compose.yml
- Rust 1.75+
- PostgreSQL 12+
- Redis 6+
git clone https://github.com/zpaynow/zeropay.git
cd zeropay
cargo build --release
./target/release/apiFor a hassle-free experience, use our managed platform at zpaynow.com:
- No infrastructure management required
- Automatic updates and security patches
- Multiple chain support out of the box
- Enterprise-grade reliability
Setup: Register at zpaynow.com and use https://api.zpaynow.com as your API endpoint.
We welcome contributions!
Email hi@zpaynow.com instead of using the issue tracker.
- Never commit
.envfiles or private keys - Use strong, randomly generated API keys
- Keep dependencies updated
- Use secure RPC endpoints
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Usage Notice: This software is intended for merchant self-hosting only — to run your own payment gateway for your own store or service. It may not be used to build or operate a payment business, payment platform, or SaaS product that serves other merchants. If you need a managed solution, use zpaynow.com.