MAILGENT
Mailgent Monetise

Get paid every time
an agent calls your API.

Wrap a handler, set a price, get paid. USDC settled in about two seconds. A signed receipt every time. Works on any REST framework and every MCP server.

Free for now·5% on settle, waived for now·No card to start

The integration

Add one line. Charge for any endpoint.

Hono, Express, Next, FastAPI, or a native MCP server — the middleware is the same idea. Wrap a handler, set a price, ship.

server.js
// One import, one wrapper. The SDK does the two-call x402 flow.
import { requirePayment } from "@mailgent/sdk/paywall/express";

app.get(
  "/api/search",
  requirePayment({ amount: "0.01" }),
  (req, res) => res.json({ results: [/* ... */] }),
);

Why Mailgent Monetise

A platform, not a primitive.

Two-second settlement.

Every paid call writes a USDC transfer to Base mainnet. The agent pays before your handler responds. No invoicing, no chargebacks, no payout schedule.

Receipts that pass an audit.

Every settle returns a signed Ed25519 receipt and a Base transaction hash. Your accountant gets what they need without translation.

Cash out anytime.

Withdraw earned USDC to any wallet, any time. Batched at scale to keep gas low. No payout cycles, no minimums.

How it works

Four steps from request to receipt.

The whole thing is HTTP. Your server reads a header and returns a status code. Mailgent does the rest — sign, settle, log, fire webhooks, and emit a receipt.

01

Agent calls your endpoint

Same URL, same shape, same auth pattern as a human caller. Nothing about your API changes — the agent sends a regular HTTP request with no payment header attached.

02

Your server replies 402

The Mailgent middleware writes a standard HTTP 402 with the price tag and the payment requirement. One line on Hono, Express, Next, FastAPI, or any MCP server.

03

Agent pays; Mailgent settles

The agent's wallet signs the payment requirement and retries. Mailgent verifies the signature, settles USDC on Base mainnet (about two seconds), then control returns to your handler.

04

Your handler runs

Your business logic runs once funds are confirmed. The response carries a signed Ed25519 receipt and a Base transaction hash. Webhooks fire if the endpoint has one configured.

Frequently asked

Things developers ask about Mailgent Monetise.

What protocol does Mailgent Monetise use under the hood?
x402 — an open, HTTP-native payments protocol. Sellers reply 402 with a payment requirement; buyers sign and retry. Mailgent handles both the seller and buyer sides so you do not have to know the protocol details. The middleware abstracts the spec; you write requirePayment() and ship.
Do I need a crypto wallet to start?
No. When you sign up, Mailgent provisions a smart wallet on Base for your project. It is not a custodial private key — Mailgent acts as a relayer on your behalf. You receive USDC into the wallet on the first paid call and can withdraw to any address you control.
What frameworks are supported?
Hono, Express, Next.js, FastAPI, Flask, and any MCP server (streamable HTTP or stdio) on day one. Adding a new framework is small — file an issue if yours is missing.
How do I price my endpoints?
You set the price per route as a string in the middleware: requirePayment({ amount: '0.05' }). Different routes can have different prices. A single project can charge $0.01 on a fast read and $1 on a long-running job. Pricing strategies are entirely yours — Mailgent is the rail.
What about failed calls?
Verify happens before your handler runs; settle happens after. If your handler throws or returns an error, the settle never fires — the buyer is not charged. If verify fails (bad signature, replay, expired), the request is rejected with a fresh requirement. Buyers can retry; nobody gets charged for failures.
Can the same agent pay multiple endpoints?
Yes. Buyer-side agents hold a Mailgent wallet bound by a mandate (per-tx cap, per-day cap, allowlist of endpoints). The wallet pays paid APIs and MCP tools across the open web within those bounds. Every call writes to the activity log on both sides.
Where do my customers come from?
Opt your endpoint into the Mailgent Index and it appears in the public catalog at mailgent.dev/idx. Buyer agents (Claude, Cursor, Goose, plus anything integrating @mailgent/sdk on the buyer side) query the index, price-compare, and start paying. You also keep your own distribution — Mailgent is additive, not exclusive.
What is the fee?
5% on settled mainnet payments — waived for now. No card, no monthly fee, no per-seat. The fee scales with usage, not with team size.

Sign up. Copy the snippet. Get paid.

Five minutes from signup to your first paid call — most of that is the signup.