io.github.TheMemeBanker/nory-x402
x402 payment processor for AI agents. Sub-400ms settlement on Solana + 7 EVM chains.
Ask AI about io.github.TheMemeBanker/nory-x402
Powered by Claude · Grounded in docs
I know everything about io.github.TheMemeBanker/nory-x402. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Nory - x402 Payment Protocol Implementation
The fastest, most efficient x402 payment processor for AI agents and micropayments.
What is x402?
x402 is an open HTTP payment protocol that enables:
- AI agents to pay for API access programmatically
- Micropayments without traditional payment rails
- Multi-chain support (Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, and more)
When a client requests a paid resource, the server responds with HTTP 402 and payment requirements. The client pays and retries with proof of payment.
Features
- Multi-chain: Solana + 7 EVM chains supported
- 0.1% fees: Lowest in the industry
- Sub-second verification: Optimized for speed
- Echo mode: Test payments with real refunds
- Enterprise security: API keys, HMAC signing, rate limiting
- Observability: Structured logging, metrics, health checks
Quick Start
Installation
npm install @nory/x402-client
Client Usage
import { NoryClient } from '@nory/x402-client';
const client = new NoryClient({
baseUrl: 'https://noryx402.com',
apiKey: 'your_api_key', // optional
});
// Make a payment
const result = await client.pay({
resource: 'https://api.example.com/premium-endpoint',
network: 'solana-mainnet',
amount: '1000000', // 1 USDC (6 decimals)
payTo: 'merchant_wallet_address',
});
Server Integration
Add x402 payment requirements to any endpoint:
// Return 402 with payment requirements
return new Response(null, {
status: 402,
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
x402Version: 2,
accepts: [{
network: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
amount: '1000000',
currency: 'USDC',
payTo: 'YOUR_WALLET_ADDRESS',
}],
resource: request.url,
}),
});
API Endpoints
| Endpoint | Description |
|---|---|
POST /api/x402/verify | Verify a payment before settlement |
POST /api/x402/settle | Settle a verified payment on-chain |
GET /api/x402/requirements | Get payment requirements for a resource |
GET /api/x402/transactions/{id} | Look up transaction status |
GET /api/x402/health | Service health check |
GET /api/x402/metrics | Performance metrics |
Supported Networks
| Network | Chain ID | Type |
|---|---|---|
| Solana Mainnet | solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp | Solana |
| Solana Devnet | solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 | Solana |
| Base | eip155:8453 | EVM |
| Polygon | eip155:137 | EVM |
| Arbitrum | eip155:42161 | EVM |
| Optimism | eip155:10 | EVM |
| Avalanche | eip155:43114 | EVM |
| Sei | eip155:1329 | EVM |
| IoTeX | eip155:4689 | EVM |
Self-Hosting
Prerequisites
- Node.js 18+
- PostgreSQL database
- Solana/EVM wallet for receiving payments
Setup
- Clone the repository:
git clone https://github.com/TheMemeBanker/x402-pay.git
cd x402-pay
- Install dependencies:
npm install
- Configure environment:
cp .env.example .env
# Edit .env with your configuration
- Initialize database:
npx prisma db push
- Run development server:
npm run dev
Environment Variables
See .env.example for all configuration options. Key variables:
MERCHANT_WALLET- Your wallet address for receiving paymentsDATABASE_URL- PostgreSQL connection stringNORY_API_KEY- Master API key for authenticationREFUND_WALLET_SECRET_KEY- (Optional) For Echo mode refunds
Security
- API key authentication on all sensitive endpoints
- HMAC request signing for webhook verification
- Rate limiting per IP and API key
- No secrets stored in code or git history
Documentation
Full documentation at noryx402.com/docs
License
MIT License - see LICENSE
Contributing
Contributions welcome! Please read our contributing guidelines before submitting PRs.
Links
- Website: noryx402.com
- Documentation: noryx402.com/docs
- NPM Package: @nory/x402-client
