standing orders for agents — Signed mandate documents plus a client-side scheduler that pays per run over x402 and collects signed run reports. No subscriptions, no stored cards, no server-side pulls.
Recurring billing normally means handing a merchant pull-access to your money (cards, direct debit) and hoping cancellation works. With x402 the recurrence inverts: the payer's scheduler initiates every run with a per-request USDC micropayment, so the budget cap is enforced by not paying again. Each run returns its signed report in the same response — pay, get artifact, done.
Every paid route answers an unpaid request with a 402 whose accepts array
carries both rails:
| Rail | Networks | Asset | payTo |
|---|---|---|---|
| EVM | base-sepolia (default) · base |
USDC | 0x40252CFDF8B20Ed757D61ff157719F33Ec332402 |
| Solana | solana-devnet (default) · solana |
USDC | WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW |
Each rail settles through its own facilitator — they are not interchangeable:
| Rail | Facilitator | Env |
|---|---|---|
| EVM | https://x402.org/facilitator |
FACILITATOR_URL |
| Solana | https://facilitator.payai.network |
SOLANA_FACILITATOR_URL |
The x402.org reference facilitator settles Base but not Solana, so the Solana
rail defaults to PayAI's. On Solana, extra.feePayer is that facilitator's
sponsor account — discovered from its /supported endpoint at boot — so a payer
needs only USDC, never SOL for gas.
git clone https://github.com/nirholas/x402-recurring && cd x402-recurring
npm install
cp .env.example .env # optional — every value has a working default
npm run dev
# in another terminal, the full paid flow on the EVM rail:
PRIVATE_KEY=0xYourFundedBaseSepoliaKey npm run client# recurring paid runs on the mandate's cadence:
PRIVATE_KEY=0xYourFundedBaseSepoliaKey npm run scheduler| Route | Price | What you get back |
|---|---|---|
POST /mandates |
free | Signed mandate document |
POST /execute/:mandateId |
$0.005 (per mandate — its own pricePerRun) |
Signed run report: run number, budget state, and the task artifact |
GET /mandates/:id |
free | Mandate status snapshot |
GET /mandates |
free | Mandate summaries |
POST /verify |
free | `{ valid: true |
GET /health |
free | { ok: true } |
GET /.well-known/x402 |
free | Machine-readable discovery manifest |
Built-in self-contained tasks: heartbeat (liveness snapshot), counter (progress across runs), digest (sha256 + stats of a posted payload).
- Call a paid route with no payment → 402 with
accepts[]quoting the exact price on both rails. - Your client picks a rail and signs: EIP-3009
transferWithAuthorization(EVM) or a serialized SPL transfer (Solana). - Retry with the
X-PAYMENTheader. The facilitator for that rail verifies and settles. - The server returns the artifact in the 200 body, plus
X-PAYMENT-RESPONSEcarrying{ rail, network, transaction, payer }.
Mainnet: NETWORK=base, SOLANA_NETWORK=mainnet-beta, and mainnet-capable
FACILITATOR_URL / SOLANA_FACILITATOR_URL.
Fully self-contained — no external APIs and no API keys. State is file-based (data/mandates.json) and the built-in tasks compute their results locally.
Artifacts are signed with HMAC-SHA256 using SIGNING_SECRET; the dev default
(dev-secret-change-me) is public, so set your own in production.
- skill.md: skill.md — agent-facing endpoints, prices, schemas, error codes.
- Discovery manifest:
/.well-known/x402, served live by the app, listing both networks per resource — indexable by x402scan.com, the x402 Bazaar, and agentic.market. List your deployment there so paying agents can find it. - MCP: examples/mcp-tool.md — wrap these routes as MCP tools for Claude.
- Raw flow: examples/curl.md — the 402 → pay → 200 walkthrough by hand.
Full docs on GitHub Pages: https://nirholas.github.io/x402-recurring/ — tutorial · API reference · for agents
Part of the x402 Suite.
If x402-recurring saves you time, star it on GitHub. Stars are how other developers and AI agents find the repositories worth trusting, and they cost you one click.
Know someone who would use it? Post on X · Share on Bluesky · Share on LinkedIn · Submit to Hacker News · Share on Reddit
Coding agents and LLM tooling can read this repo directly: AGENTS.md, llms.txt, llms-full.txt. Point an agent at https://github.com/nirholas/x402-recurring and it has the context it needs.
- All repositories by nirholas: the full catalog, grouped by topic
- three.ws: the platform for 3D AI agents with Solana wallets, a skill marketplace and x402 payments
- Questions or ideas: open an issue or start a discussion