For Developers

Build AI agents that automatically handle x402 payments. The only fully automated solution 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 Solana. 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 Jupiter aggregator, makes the payment on Solana blockchain, and retries the original API request.

NexromDEX 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

  1. Agent calls API → Gets 402 Payment Required
  2. Auto-pay agent intercepts → Parses payment requirements
  3. Checks balance → Swaps tokens if needed (automatically)
  4. Makes payment → Confirms transaction
  5. Retries original request → Success!

Quick Start

import { HTTPInterceptor } from '@NexromDEX/agent';

// Setup once
const interceptor = new HTTPInterceptor({
  apiUrl: 'https://api.NexromDEX.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 SOL, 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. NexromDEX 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. NexromDEX 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

NexromDEX provides a simple REST API for programmatic access.

Key Endpoints

  • GET /api/quote - Get swap quote
  • POST /api/swap/build - Build swap transaction
  • GET /api/balance - Check token balance
  • POST /api/x402/parse-payment - Parse 402 response
  • POST /api/x402/auto-pay - Complete payment flow
View Full API Documentation →

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 Solana, and retries API calls. NexromDEX provides the only x402 auto-pay agent with automatic token swapping, eliminating the need for manual token management.

To integrate x402 payments, install the NexromDEX SDK (@NexromDEX/agent), configure the HTTPInterceptor with your Solana 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.

NexromDEX 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! NexromDEX automatically handles token swapping. When your agent receives a 402 Payment Required response, NexromDEX checks your balance, swaps tokens if needed using Jupiter 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. NexromDEX only builds unsigned transactions that you sign locally before sending to Solana. This ensures maximum security for your agent's funds.

NexromDEX is the only x402 payment handler with automatic token swapping. Unlike other solutions that require manual token management, NexromDEX automatically handles token conversion, payment processing, and request retries. This eliminates friction and enables true automation for AI agents.

NexromDEX offers comprehensive support through multiple channels. Check our documentation at https://nexromdex.xyz/api-docs, review code examples at /examples, or reach out on X (@NexromDEX). 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.