โ† Back to Home

For API Providers

Monetize your API with x402 payments. AI agents pay automaticallyโ€”including automatic token swapping if needed. Higher conversion, instant payments, zero manual processing.

Why x402 + MoltyDEX?

๐Ÿ’ฐ 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 MoltyDEX 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 MoltyDEX. 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

Ready to Start Charging?

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