← All posts

How to Add Wallet Screening to Cloudflare Agents + x402

Cloudflare now supports x402 across its Agents SDK and MCP flows. That solves the payment side. The next production question is what to do after the payment verifies and before your agent or route actually does work.

Cloudflare’s current x402 docs already cover the important building blocks: charging for MCP tools, paying from the Agents SDK, and gating HTTP content. That makes Cloudflare one of the most practical places to build paid agent workflows right now.

But x402 answers one question cleanly: did the caller present a valid payment flow? It does not answer the other question route operators still care about: should this wallet be allowed through the workflow at all?

The Missing Layer

For paid Cloudflare agent workflows, the clean pattern is:

1. Cloudflare Agent or Worker receives the request 2. x402 handles payment verification 3. Wallet screening checks the payer or destination wallet 4. The route decides allow / review / block 5. Only then does the expensive work run

That keeps payment and trust as separate concerns. x402 confirms the payment path. Screening decides whether the counterparty looks safe enough for the workflow.

Where This Fits In Cloudflare

Cloudflare now documents three x402 patterns that matter here:

The wallet-screening step belongs immediately after the x402 check on the server side, especially for HTTP endpoints or paid MCP-backed tools that trigger expensive work.

A Simple Worker-Oriented Pattern

If you are using a Hono Worker route behind x402, the shape looks like this:

import { Hono } from 'hono' import { paymentMiddleware } from 'x402-hono' import { agentScoreGate } from 'x402-agent-score' const app = new Hono() app.use( paymentMiddleware( '0xYourWalletAddress', { '/premium': { price: '$0.10', network: 'base', config: { description: 'Premium agent route' }, }, }, { url: 'https://x402.org/facilitator' }, ), ) app.use( agentScoreGate({ minScore: 25, onUnknown: 'allow', }), ) app.get('/premium', (c) => c.json({ ok: true }))

The exact x402 middleware may vary depending on whether you are using Cloudflare’s MCP tooling, their HTTP content pattern, or your own Worker route. The important idea does not change: verify payment first, then screen the wallet, then run the protected logic.

Why This Matters More On Cloudflare

Cloudflare is a natural place to put paid agent workflows because it already gives you global Worker execution, MCP server support, and agent runtime tooling. That also means it becomes a natural place to waste compute if every wallet with a valid payment can hit an expensive route without one more check.

The wedge: x402 lets the wallet pay. Wallet screening decides whether the wallet should get through the gate.

How To Roll It Out Safely

That is the boring rollout, which is usually the right one.

What This Post Is Really Saying

Cloudflare already gives builders a clean x402 surface. AgentScore is the extra workflow-protection layer that fits on top of it. If you are building paid routes, MCP tools, or payout flows on Cloudflare, the trust decision still needs a home.

Use the published middleware, then start with a conservative pilot policy.

Open Docs