Subscriptions are the wrong billing model for metered APIs. You build rate limits, plans, dunning emails and a Stripe integration — and a buyer who just wants 500 calls still has to create an account, add a card and get approved. Stablecoins fix this: USDC settles per call, on-chain, in seconds, for anyone in the world.
After adding stablecoin payments to several Node.js services, here is the pattern that works with the least code: HTTP 402 pay-per-call, verified on-chain.
How it works
- A client calls your endpoint without paying
- Your server answers
402 Payment Requiredwith a challenge (amount, USDC contract, your wallet) - The client sends USDC on Base and retries with a payment header
- Your server verifies the transfer against the chain and serves the response
No accounts. No API keys to leak. No chargebacks. Revenue lands directly in your wallet.
The server in ~20 lines
import express from "express";
import { paywall } from "usdc-paywall";
const app = express();
const gate = paywall({
payTo: "0xYourWallet",
amount: "0.50", // USDC per call
chainId: 8453, // Base
});
app.get("/api/predict", gate, (req, res) => {
// payment already verified on-chain here
res.json({ ok: true });
});
app.listen(3000);
That is the whole integration. usdc-paywall handles the 402 challenge, receipt signature, and on-chain verification of the incoming USDC transfer before your handler runs.
Why per-call stablecoin billing beats subscriptions for APIs
- Zero onboarding: AI agents and scripts pay directly, no signup flow
- Global by default: USDC works where Stripe does not
- No fee bleed: no per-invoice platform cut, just gas (<$0.01 on Base)
- Machine-ready: this is the billing layer AI agents can actually use without a human
Getting started
- Package:
npm i usdc-paywall - Source and full docs: https://github.com/essentoclothes/usdc-paywall
- A production-grade variant (multi-chain, signed receipts, spend analytics) is available as usdc-paywall Pro ($19): https://www.npmjs.com/package/@josealbertomaquina/usdc-paywall
If you sell API access and hate billing complexity, stablecoin pay-per-call is the simplest monetization I have found.
Top comments (0)