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
- Agent calls your API โ Request for data/service
- You return 402 Payment Required โ With payment requirements
- Agent automatically pays โ Using MoltyDEX auto-pay agent
- Agent retries request โ With payment proof
- 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.