β‘ Stop waiting for testnet faucets. Start building x402 agents in 30 seconds.
npx @xpay/x402-localThat's it! In 30 seconds you get:
- β Local facilitator running on :3402
- β 5 funded test wallets created
- β Instant payment confirmations
- β Ready for x402 development!
No testnet setup. No faucet waiting. No slow confirmations.
ποΈ Local Facilitator
- Full x402 protocol simulation on
localhost:3402 /verifyand/settleendpoints that work like mainnet- Instant confirmations (or add realistic delays for testing)
π° Pre-funded Test Wallets
- 5 wallets with different USDC balances (1000-3000)
- No faucet needed - ready to use immediately
- Private keys provided for testing agents
β‘ Zero-Friction Development
- Works with any x402 client library
- Perfect for agent development and API testing
- Docker support for CI/CD pipelines
- AI Agent Development - Test payment flows without mainnet complexity
- x402 API Development - Build and test protected endpoints locally
- Integration Testing - Verify payment logic before production
- Learning x402 - Understand the protocol without crypto friction
# Start with defaults (port 3402, 5 wallets, instant payments)
npx @xpay/x402-local
# Custom configuration
npx @xpay/x402-local start --port 3403 --wallets 10
# Add realistic delays for testing
npx @xpay/x402-local start --delay 1000
# Check status
npx @xpay/x402-local status
# Manage wallets
npx @xpay/x402-local wallets
npx @xpay/x402-local wallets --create --fund 2000-
Start the local environment:
npx @xpay/x402-local
-
Test the facilitator endpoints:
# Health check curl http://localhost:3402/health # Get payment requirements curl http://localhost:3402/payment-requirements
-
Build your x402-protected API using the local facilitator:
// Your API can now use http://localhost:3402 as the facilitator const facilitatorUrl = 'http://localhost:3402';
The local facilitator simulates a production x402 facilitator:
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check and configuration |
/verify |
POST | Verify x402 payment |
/settle |
POST | Settle verified payment |
/payment-requirements |
GET | Get payment requirements for testing |
/payments |
GET | List recent payments (debug) |
Default wallets created with x402-local start:
Wallet 1: 1000 USDC
Wallet 2: 1500 USDC
Wallet 3: 2000 USDC
Wallet 4: 2500 USDC
Wallet 5: 3000 USDC
Each wallet includes:
- Ethereum-style address (
0x...) - Private key for signing transactions
- Pre-funded USDC balance
Perfect for building AI agents that make x402 payments:
import { X402Client } from '@xpay/x402-sdk';
const client = new X402Client({
facilitatorUrl: 'http://localhost:3402',
privateKey: 'your-test-wallet-key'
});
// Your agent can now make payments to x402-protected APIs
const response = await client.request('http://your-api.com/protected-endpoint');π Next: Build complete agents with x402-agent-kit
Use in CI/CD or containerized development:
# Pull the image
docker pull xpay/x402-local
# Run with default settings
docker run -p 3402:3402 xpay/x402-local
# Custom configuration
docker run -p 3403:3403 xpay/x402-local --port 3403 --wallets 10βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Your Agent β β x402-local β β Your x402 API β
β β β Facilitator β β β
β βββββββββββββββ β β ββββββββββββββββ β β βββββββββββββββ β
β β X402 Client β βββββΆβ β /verify β ββββββ β Middleware β β
β β β β β β /settle β β β β β β
β βββββββββββββββ β β ββββββββββββββββ β β βββββββββββββββ β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
β ββββββββββββββββββββ β
ββββββββββββββββΆβ Test Wallets βββββββββββββββ
β (Pre-funded USDC)β
ββββββββββββββββββββ
x402-local is part of the complete xPay x402 developer toolkit:
- π awesome-x402 - Complete x402 resource hub
- π οΈ x402-local - Local development environment (you are here)
- π€ x402-agent-kit - Build x402-paying agents
- π¦ x402-sdk - TypeScript SDK for x402
- π§ x402-server-kit - Server middleware for all frameworks
- Core CLI with local facilitator
- Pre-funded test wallets
- Instant payment simulation
- Browser extension for testing
- Docker image for CI/CD
- WebSocket support for real-time updates
- Payment flow visualization
- Integration with popular testing frameworks
We love contributions! Please see our Contributing Guide.
Quick ways to help:
- π Report bugs or request features
- π Improve documentation
- π§ͺ Add test cases
- π‘ Suggest new features
MIT License - see LICENSE for details.
- π Documentation: Full docs
- π¬ Community: GitHub Discussions
- π Issues: Bug Reports
- π§ Email: hello@xpay.sh
π Built by xPay - Helping the agentic community get paid and pay safely
If this tool helped you build with x402, please β star the repo!
Explore x402 Resources β’
Build AI Agents β’
Learn x402 Protocol