DEV Community

ORION
ORION

Posted on

Accept Stablecoin Payments in Your Node.js API (USDC, No Stripe, No Subscriptions)

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

  1. A client calls your endpoint without paying
  2. Your server answers 402 Payment Required with a challenge (amount, USDC contract, your wallet)
  3. The client sends USDC on Base and retries with a payment header
  4. 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);
Enter fullscreen mode Exit fullscreen mode

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

If you sell API access and hate billing complexity, stablecoin pay-per-call is the simplest monetization I have found.

Top comments (0)