Inspiration
The AI agent economy has a payment problem. Thousands of small developers and startups around the world are building useful APIs and AI tools but can't compete with companies offering \$10/month free tiers. They don't have the capital to subsidize free access, so their products never get discovered. This creates a massive barrier to entry in an already competitive AI market.
When an AI agent needs to pay for a data service — a weather lookup, a stock quote, a translation — the smallest charge Stripe can process is \$0.30. That makes a \$0.01 API call mathematically impossible through traditional payment rails. There's no infrastructure for machines to pay machines at the scale and price point the AI economy demands.
We asked: what if there was a payment layer where an AI agent could pay a fraction of a cent per call, directly to the developer, with no middleman taking a 30-cent cut?
Solana transactions cost \(\sim\$0.00001\). That's the answer.
What it does
Micropay Bazaar is a micropayment gateway and orchestration layer for AI agents on Solana. It has three core flows:
For API providers — Register your API in the Bazaar with a price (as low as \$0.001), and start earning SOL every time an agent calls it. No Stripe account, no billing dashboard, no minimum fees.
For API consumers — Discover multiple prebuilt data services across weather, finance, crypto, NLP, news, sports, and more. Create a charge, sign with Phantom, and settle on Solana Devnet in under a second. Pay only for what you use.
For AI agents — Send a natural language message to our AI Gateway. GPT-4o-mini decides which paid tool to invoke using OpenAI function calling, the user approves a micro-payment, and the agent gets its data — all in one conversational loop.
The API has 15 endpoints with Stripe-inspired design patterns: prefixed IDs (ch_, srv_, req_), structured error types, idempotency with replay detection, pagination, multi-criteria filtering, and X-Request-Id tracing on every response. Every payment creates a real, verifiable on-chain Solana transaction.
How we built it
The backend is a Node.js + Express v4 server deployed on Railway. We use @solana/web3.js to build unsigned Solana transactions that get signed client-side by Phantom wallet and broadcast to Devnet. CoinGecko provides live SOL/USD price conversion with a 60-second cache and a hardcoded fallback if the API is unavailable.
The AI Gateway uses OpenAI's GPT-4o-mini with function calling — we map all registry services to OpenAI tool definitions, so the model can autonomously decide which paid data source to invoke based on a user's natural language query. Conversation history persists in memory for multi-turn context.
Our /api/ai/chat endpoint goes a step further: it fires a real on-chain Devnet transaction from a server-side keypair before calling OpenAI, so every AI query has verifiable proof-of-payment on the blockchain.
The frontend is a Next.js + TypeScript dashboard deployed on Vercel with Tailwind CSS, featuring a service marketplace, API key management, transaction history with Recharts visualizations, and an interactive AI playground with Phantom wallet integration.
We wrote a custom hosted documentation page inspired by Stripe's own API docs — with tabbed code examples in cURL, JavaScript, and Python, expandable parameter details with error cases, and two complete end-to-end integration guides.
Challenges we faced
Solana blockhash expiration was our biggest gotcha. The unsigned transaction we return from POST /charges includes a recentBlockhash that expires in \(\sim60\) seconds. If the user takes too long to sign, the transaction fails silently. We had to document the "refresh blockhash before signing" pattern and build it into our frontend SDK.
Devnet rate limits hit us hard during demo testing. Solana's Devnet RPC returns 429s when you send too many confirmTransaction calls. We solved this by making our ai/chat endpoint fire-and-forget — we sendRawTransaction with skipPreflight: true and don't await confirmation, so the transaction still lands on-chain a few seconds later without triggering rate limit retries.
Error format consistency across 5 route files and an auth middleware was tedious but critical. We went through three iterations to get every single error response — including edge cases in the OpenAI gateway and auth failures — to return the same { error: { type, message } } structure with appropriate HTTP status codes.
Idempotency sounds simple in theory but has subtle edge cases. We implemented replay detection with Idempotency-Key headers, a 24-hour TTL cache, and an Idempotency-Replayed response header so callers know if they're getting a cached result — directly modeled after Stripe's own implementation.
What we learned
Designing an API that "delights developers" (as Stripe puts it) is 80% about the details nobody notices until they're missing: consistent error formats, predictable pagination, X-Request-Id headers for debugging, clear auth error messages that tell you the expected format. We studied Stripe's API design patterns extensively and it fundamentally changed how we think about developer experience.
We also learned that blockchain has a practical, non-speculative use case in micropayments. Traditional payment rails have a floor — you can't charge less than \(\sim\$0.30\) through Stripe. Solana removes that floor entirely, and that unlocks an entire economy of sub-cent API calls that simply couldn't exist before.
What's next for Micropay Bazaar
- Mainnet deployment with real SOL payments
- Webhook notifications when payments settle on-chain
- Python and JavaScript SDK packages for one-line integration
- Service health monitoring with uptime tracking and automatic deregistration
- Multi-token support for USDC stablecoin payments alongside SOL
Built With
- anybody
- axios
- bs58
- coingecko-api
- express.js-v5
- ibm-plex-mono
- martianmono
- morgan
- next.js
- node.js
- openai-api-(gpt-4o-mini)
- phantom-wallet
- railway
- recharts
- solana-web3.js
- tailwind-css
- typescript
- vercel
Log in or sign up for Devpost to join the conversation.