For API Providers

Get paid automatically for your API with x402 protocol. Higher conversion, instant payments, zero manual processing.

What is x402 API Payments?

x402 API payments is a payment protocol for Solana that enables pay-per-use API monetization. When your API requires payment, you return HTTP 402 Payment Required with payment details (amount, token, recipient address).

AI agents using NexromDEX automatically handle these x402 payments, including automatic token swapping if needed. This means agents can pay with any token, even if you specify a different one, significantly increasing conversion rates. Payments are instant, automatic, and require zero manual processing on your side.

Why x402 + NexromDEX?

πŸ’°

Automatic Payments

Agents pay automatically. No manual payment processing needed.

πŸ”„

Any Token

Accept any Solana token. Agents swap automatically if needed.

⚑

Seamless Integration

Just return 402 with payment requirements. That's it.

πŸ“ˆ

Higher Adoption

Agents can use your API without manual payment steps.

How It Works

1
Agent calls your API β†’ Request for data/service
2
You return 402 Payment Required β†’ With payment requirements
3
Agent automatically pays β†’ Using NexromDEX auto-pay agent
4
Agent retries request β†’ With payment proof
5
You serve the request β†’ Payment verified, data returned

Implementation

Step 1: Return 402 Response

// Your API endpoint
app.get('/api/data', (req, res) => {
  // Check if payment required
  if (!hasPayment(req)) {
    return res.status(402).json({
      accepts: [{
        network: 'solana',
        asset: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
        amount: '1000000', // 1 USDC (6 decimals)
        address: 'YOUR_PAYMENT_ADDRESS'
      }]
    });
  }
  
  // Payment verified, return data
  res.json({ data: '...' });
});

Step 2: Verify Payment

// Verify payment from X-Payment header
function verifyPayment(req) {
  const paymentSignature = req.headers['x-payment'];
  // Verify signature on Solana blockchain
  // Check amount, token, recipient match
  return isValid;
}

Benefits

πŸš€

Higher Conversion

Agents pay automatically with zero friction. No manual payment steps means more API usage and higher revenue.

πŸ’°

Instant Payments

Payments settle on-chain instantly. No waiting periods, chargebacks, or manual processing delays.

πŸ”„

Accept Any Token

Agents automatically swap to your required token via NexromDEX. Accept USDC, SOL, or any Solana token seamlessly.

🌐

Global & 24/7

Accept payments from anywhere in the world, anytime. Solana operates globally without borders or banking hours.

πŸ”’

Secure & Transparent

All payments are on-chain, verifiable, and immutable. No chargebacks, no disputesβ€”just secure transactions.

πŸ“ˆ

Scalable Revenue

Charge per-request, per-call, or per-operation. Perfect for APIs with variable usage patterns. Scale revenue with usage.

Resources

Frequently Asked Questions

x402 API payments is a payment protocol for Solana that enables pay-per-use API monetization. When an API requires payment, it returns HTTP 402 Payment Required with payment details. AI agents using NexromDEX automatically handle these payments, including token swapping if needed, making it seamless for API providers to charge per-use.

To accept x402 payments, return HTTP 402 Payment Required with payment details (amount, token, recipient address) when payment is required. AI agents using NexromDEX will automatically handle the payment, swap tokens if needed, and retry the request. No additional integration needed on your side.

You can accept any SPL token on Solana, including SOL, USDC, USDT, or any custom token. NexromDEX automatically handles token swapping, so agents can pay with any token even if you specify a different one. This increases conversion rates significantly.

Payments are sent directly to your Solana wallet address on-chain. When an agent makes a payment, you receive the tokens immediately. There's no manual processing, no waiting periods, and no intermediaries. Payments are instant and automatic.

x402 payments offer several benefits: automatic payment processing (no manual handling), higher conversion rates (agents pay automatically), instant payments (on-chain, no delays), any token acceptance (agents swap automatically), and zero payment processing fees (only Solana network fees).

You set payment amounts in the HTTP 402 response header. Include the required amount, token address, and your Solana wallet address. Agents using NexromDEX will automatically parse these details, swap tokens if needed, make the payment, and retry the request. You have full control over pricing per API call.

If an agent doesn't have sufficient funds or fails to pay, the 402 response remains and the agent cannot access your API. This ensures you only provide service when paid. Agents using NexromDEX automatically handle payments, so payment failures are rare and handled gracefully.

Yes! You can specify any SPL token in your 402 response. Since NexromDEX automatically swaps tokens, agents can pay with any token they have, even if you specify a different one. This flexibility increases conversion rates and makes your API more accessible.

Payments are on-chain Solana transactions, so you can track them using any Solana blockchain explorer or your own monitoring system. Each payment is a transparent on-chain transaction that you can verify and track. You can also implement your own analytics to monitor API usage and revenue.

There's no minimum payment amount enforced by NexromDEX. However, Solana network fees (typically 0.000005 SOL) apply to each transaction. You can set any payment amount you want for your API calls, from micropayments to larger amounts. The x402 protocol is designed to support flexible pricing.

Ready to Start Charging?

Integrate x402 payments into your API. Get started in minutes.