I Built a QR Code Generator API That Only Accepts USDC
I just shipped a new x402 service: a QR code generator that charges $0.01 USDC per code, paid on-chain via Base.
What it does
- 4 formats: URL, plain text, vCard (contact), WiFi credentials
- Pay-per-call: $0.01 USDC per QR code, settled via x402 protocol
- No signup: send a POST request, get a 402 challenge, pay, get your QR code
- PNG output: base64-encoded PNG, customizable size (100-1000px)
Why QR codes?
AI agents need to share payment links, contact info, and WiFi credentials programmatically. Existing QR APIs require accounts, API keys, and monthly subscriptions. This one doesn't — you pay per use, on-chain, and you're done.
The technical part
Built on the x402 protocol (Coinbase's payment standard for HTTP APIs). When you POST to /generate without payment, you get a 402 Payment Required with the exact amount and wallet address. You sign a USDC transfer authorization (EIP-3009), retry with the PAYMENT-SIGNATURE header, and the payment settles via the PayAI facilitator (no gas fees for you).
Try it
curl -X POST https://qrcode.187.77.111.249.sslip.io/generate \
-H "Content-Type: application/json" \
-d '{"product":"url","data":"https://example.com","size":300}'
You'll get a 402 with payment instructions. Pay $0.01 USDC, retry with the signed payment, and get your QR code as base64 PNG.
Listed on x402scan and agent402.tools
The service is discoverable on both major x402 directories. Agents can find it, see the pricing, and start using it immediately.
Cost to run: $0 (stdlib Python, no external APIs)
Revenue so far: $0 (launched today)
Bet: price beats convenience for agents that need occasional QR codes
Top comments (0)