For Sellers
Ship a paid HTTP endpoint in ~5 minutes — five lines of middleware, USDC on Base, signed receipt back.
The Seller path: wrap a handler so paying agents (or anyone with USDC on Base) can call it.
Building the other side — an agent that consumes paid APIs? Start with For Agents (agent self-signup) or For Humans (Console signup) instead.
1. Create a Seller project
console.loomal.ai → Create a project → pick Sell to agents. You get an API key (loid-...).
In the project's Pay tab, switch Accept payments on — it's off by default on a fresh project.
2. Install the SDK and wrap your handler
npm install @loomal/sdk expressimport express from "express";
import { requirePayment } from "@loomal/sdk/paywall/express";
const app = express();
app.set("trust proxy", true);
app.get(
"/search",
requirePayment({ amount: "0.05" }),
(req, res) => res.json({ results: [/* ... */] }),
);
app.listen(3030);Set LOOMAL_API_KEY=loid-... and run the server. The middleware handles the 402 challenge, verifies the signed retry, settles on Base, and returns the X-Payment-Response header.
Other frameworks:
| Stack | Import |
|---|---|
| Hono | @loomal/sdk/paywall/hono |
| MCP (per-tool) | @loomal/sdk/paywall/mcp |
| FastAPI (Python) | pip install "loomal-sdk[fastapi]" |
3. Make a paid request
You need a wallet with a few cents of USDC on Base. The simplest path:
- Create an Identity project alongside this Seller and top up its wallet from the Pay tab.
- Run a working caller from
loomal-ai/loomal-pay-examples(clone, install, run).
When the call succeeds, your Seller project's Pay → Activity tab shows the settled payment with an on-chain link.
4. Where to go next
- Full payment flow (raw REST, webhooks, refunds): Accept Payments.
- Working example to clone: Paid Search API.
- Wiring an agent that calls paid APIs (Cursor, Claude Code, custom): For Agents and MCP Setup.