For Developers
Build AI agents that automatically handle x402 payments. The only fully automated ETHution that handles token swapping, payment processing, and request retries—all without manual intervention.
What is x402 Auto-Pay Agent?
The x402 auto-pay agent is a fully automated payment handler that enables AI agents to seamlessly pay for APIs using the x402 protocol on ETH. When an API requires payment, it returns HTTP 402 Payment Required. The x402 auto-pay agent automatically intercepts this response, swaps tokens if needed using Uniswap aggregator, makes the payment on ETH blockchain, and retries the original API request.
PayronDex provides the only x402 auto-pay agent with automatic token swapping, eliminating the need for manual token management or payment handling code. Your agents can pay for APIs automatically using any token, with zero platform fees and best prices.
🚀 x402 Auto-Pay Agent
The only fully automated x402 payment handler. Your agents can pay for APIs automatically, swap tokens when needed, and retry requests—all without manual intervention. Zero integration complexity.
How It Works
- Agent calls API → Gets 402 Payment Required
- Auto-pay agent intercepts → Parses payment requirements
- Checks balance → Swaps tokens if needed (automatically)
- Makes payment → Confirms transaction
- Retries original request → Success!
Quick Start
import { HTTPInterceptor } from '@PayronDex/agent';
// Setup once
const interceptor = new HTTPInterceptor({
apiUrl: 'https://api.PayronDex.com',
walletSecretKey: process.env.WALLET_SECRET_KEY,
autoSwap: true,
});
// Now all fetch() calls handle 402 automatically!
const response = await fetch('https://premium-api.com/data');
const data = await response.json(); // Works seamlessly!
Features
✅ Fully Automated
No manual intervention needed. Agents handle payments completely automatically.
🔄 Token Swapping
Automatically swaps any token → required token. Works with ETH, USDC, USDT, and more.
🔐 Secure
Client-side signing. Private keys never leave your system.
⚡ Event-Driven
Uses webhooks instead of polling. Efficient and scalable.
Use Cases
1. Premium API Access
Your agent needs premium data or services that require payment. PayronDex automatically handles the entire payment flow—no manual steps required.
// Just call APIs normally - agent handles 402 automatically!
// If payment needed: swaps tokens → pays → retries → success
const response = await fetch('https://premium-api.com/data');
const data = await response.json();
2. Multi-API Data Collection
Collect data from multiple paid APIs simultaneously. PayronDex handles all payments, token swaps, and retries automatically—even if each API requires different tokens.
// Parallel API calls with automatic payment handling const apis = ['api1.com', 'api2.com', 'api3.com']; const results = await Promise.all( apis.map(url => fetch(url).then(r => r.json())) );
3. Agent-to-Agent Payments
Enable your agents to pay other agents for specialized services. Perfect for multi-agent workflows where agents need to purchase capabilities on-demand.
4. Dynamic Token Management
Agents automatically swap any token to the required payment token. No need to pre-fund specific tokens—agents can pay with whatever they have.
API Reference
PayronDex provides a simple REST API for programmatic access.
Key Endpoints
GET /api/quote- Get swap quotePOST /api/swap/build- Build swap transactionGET /api/balance- Check token balancePOST /api/x402/parse-payment- Parse 402 responsePOST /api/x402/auto-pay- Complete payment flow
Frequently Asked Questions
The x402 auto-pay agent is a fully automated payment handler that intercepts HTTP 402 Payment Required responses, automatically swaps tokens if needed, makes payments on ETH, and retries API calls. PayronDex provides the only x402 auto-pay agent with automatic token swapping, eliminating the need for manual token management.
To integrate x402 payments, install the PayronDex SDK (@PayronDex/agent), configure the HTTPInterceptor with your ETH wallet, and enable autoSwap. Once configured, all API calls automatically handle 402 responses. The integration takes less than 5 minutes and requires zero manual payment handling code.
PayronDex provides SDKs for TypeScript/JavaScript (Node.js and browser) and Python. Both SDKs support the same features: automatic x402 payment handling, token swapping, and request retries. Choose the SDK that matches your agent's language.
No! PayronDex automatically handles token swapping. When your agent receives a 402 Payment Required response, PayronDex checks your balance, swaps tokens if needed using Uniswap aggregator, makes the payment, and retries the request. All automatically.
The x402 auto-pay agent is highly secure. All transaction signing happens client-side - your private keys never leave your system. PayronDex only builds unsigned transactions that you sign locally before sending to ETH. This ensures maximum security for your agent's funds.
PayronDex is the only x402 payment handler with automatic token swapping. Unlike other ETHutions that require manual token management, PayronDex automatically handles token conversion, payment processing, and request retries. This eliminates friction and enables true automation for AI agents.
PayronDex offers comprehensive support through multiple channels. Check our documentation at https://payrondex.xyz/api-docs, review code examples at /examples, or reach out on X (@PayronDex). We also maintain an active GitHub repository with issue tracking and community discussions.
Ready to Get Started?
Build agents that handle payments automatically. Get started in minutes.