x402 Payment Gateway
Enable AI agents to autonomously pay for database queries using USDC cryptocurrency on Base network via the x402 payment protocol.
What is x402?
The x402 Payment Gateway transforms your SerenDB database into a monetized API service where AI agents can autonomously:
Pay per query using USDC stablecoin on Base network
Execute SQL queries after depositing funds
Track spending with immutable blockchain audit trails
Access databases without human intermediaries
Key Features
Autonomous AI Agent Payments
AI agents can deposit USDC, check balances, and execute queries without human intervention.
Blockchain-Verified Transactions
All payments are verified on-chain using Base network (Ethereum L2) for low fees and fast confirmation.
Flexible Pricing Models
Configure pricing based on:
Rows returned (per 1000 rows)
Query complexity (PostgreSQL EXPLAIN cost)
Data transfer (per MB)
Query type (SELECT, INSERT, UPDATE, DELETE)
Time-based usage
Multi-Provider Support
Multiple database providers can register and configure independent pricing structures.
Immutable Audit Trail
Every transaction is recorded both on-chain and in the gateway database for complete transparency.
How It Works
1. AI Agent requests database query
↓
2. Gateway checks agent's USDC balance
↓
3. [No balance] → HTTP 402 Payment Required
↓
4. Agent deposits USDC on Base network
↓
5. Gateway verifies on-chain payment
↓
6. Query executed and results returned
↓
7. Cost deducted from agent's balanceQuick Links
Get Started - Set up your first x402 provider
API Reference - Complete API endpoint documentation
Pricing Models - Configure flexible pricing strategies
Examples - Code examples for common use cases
Use Cases
Database Monetization
Convert your SerenDB instance into a revenue-generating API service.
AI Agent Data Access
Enable autonomous agents to purchase database access for analytics, reporting, or machine learning.
Pay-per-Use APIs
Offer fine-grained pricing based on actual usage rather than subscription tiers.
Blockchain Audit Trails
Maintain cryptographic proof of all transactions for compliance and accounting.
Production Deployment
The x402 Gateway is deployed at: https://x402.serendb.com/
All endpoints are production-ready with:
Rate limiting
SQL injection prevention
CORS security headers
Encrypted API keys
99.9% uptime SLA
Getting Started
Ready to monetize your database? Start with our Quick Start Guide.
Last updated