PFlux
DOCS
GitHub Integration enquiries
INTEGRATIONS/AGENT PAYWALL

Agent Paywall for WordPress

AI agents pay to read what you choose. People see your site as always. No WooCommerce needed.

PLUGINP2Flux Agent Paywall
VERSION0.6.1
NEEDSWordPress 6.5+, PHP 8.1+
WOOCOMMERCENot needed
FEE1% (min 0.003) · prepaid 3%

What it does

AI agents — assistants, research tools, crawlers — read websites for their users. With this plugin they pay you for it. When an agent opens a post you made paid, your site answers 402 Payment Required with a price; the agent pays in USDC and gets the post. The money goes to your wallet. People visiting your site see nothing different.

Set up

Install it from the WordPress.org plugin directory: Plugins → Add New, search for “P2Flux Agent Paywall”. (The ZIP is also on GitHub.)

  • Install and activate P2Flux Agent Paywall.
  • Settings → Agent Paywall: paste your wallet address (a wallet on Base that receives USDC). P2Flux checks the address when you save; a mistyped one is refused.
  • Choose what agents pay for and the price. Save.

No account, no API key, nothing to install on the server. Start in Test mode (Base Sepolia, test USDC) and switch to Live when you have seen it work.

SettingEffect
Post typesEvery post of the ticked types costs the default price.
CategoriesOnly posts in the ticked categories are paid.
Price box in the editorA post’s own price. Empty follows the settings; 0 makes it free.
Paid API routesYour own REST routes, one prefix per line. Every caller that is not logged in pays. WordPress’s own routes (/wp/…) cannot be listed.

In lists, feeds, search and REST collections an agent sees the title and the price of a paid post, not its text. The smallest price is 0.01 USDC.

Paid files

A file in the Media Library — a PDF, a dataset, an image — can have a price too: open the file and fill in “Price for AI agents”. People download it as always; an agent gets 402 and the file after payment.

WordPress does not see requests for uploaded files; the web server answers them itself. So the plugin writes a rule into the uploads folder that sends AI agents’ requests for the priced files — those files and no others — through WordPress. Apache and LiteSpeed read it from .htaccess — nothing to do. On nginx, add one block per file you sell inside the server block, and reload nginx:

nginx
location = /wp-content/uploads/2026/09/fish-prices.csv {
    set $p2flux_agent 0;
    if ($http_user_agent = "") { set $p2flux_agent 1; }
    if ($http_user_agent ~* "(GPTBot|ChatGPT-User|OAI-SearchBot|ClaudeBot|Claude-User|anthropic-ai|PerplexityBot|CCBot|Bytespider|Amazonbot|meta-externalagent|python-requests|python-httpx|aiohttp|axios/|node-fetch|undici|Go-http-client|curl/|Wget/|Scrapy|x402|P2Flux-MCP)") { set $p2flux_agent 1; }
    if ($http_payment_signature != "") { set $p2flux_agent 1; }
    if ($http_signature_agent != "") { set $p2flux_agent 1; }
    if ($p2flux_agent) { rewrite ^/wp-content/uploads/(.+)$ /index.php?p2flux_ap_file=$1 last; }
}

Only a Media Library file with a price is ever sent through WordPress; a request for any other file there is answered 404, so the rule must name only files you gave a price.

Without the rule a paid file still has a paid address: /?p2flux_ap_file=<id>. Images inside a paid post are not paid unless you give them a price.

Who is asked to pay

VisitorResult
A person with a browserReads as always.
A logged-in userReads as always.
Search engines and link previews (Google, Bing, Apple, DuckDuckGo, Slack, …)Read as always.
AI crawlers and assistants (GPTBot, ClaudeBot, PerplexityBot, …), HTTP libraries, x402 clients402 with the price; the post after payment.
A request signed as a bot (Web Bot Auth), whatever its user agent402 with the price.

An agent is recognised by an x402 payment on the request, by a bot signature, or by its user agent. The list can be changed with the p2flux_ap_agent_signatures filter.

Web Bot Auth is how an agent proves who it is: it signs each request and publishes its keys (ChatGPT agent does). When such an agent pays, the plugin checks the signature against the keys the agent publishes and shows the agent’s name next to the payment. A signature never makes anything free.

Pay per page and prepaid

Pay per pagePrepaid balance
How the agent paysOne payment per page.Puts at least 1 USDC aside once, then pays each page with a signature.
TransactionsOne per page.None per page.
You receiveAt once.In one payout at 2 USDC, or weekly.
P2Flux keeps1%, at least 0.003 USDC.3% of the payout.
For a 0.05 USDC page you get0.0470.0485

Both are offered to every agent; it uses the one it supports. Prepaid can be switched off in the settings. One payment opens one page once: the same payment presented again is refused. An agent can ask for its unused prepaid balance back once it has used at least 0.10 USDC of it, or after 24 hours without use; unused balances also come back on their own after 7 days, and an agent can always withdraw from the escrow directly. What it already spent is yours.

Earnings

The settings page shows what agents paid today, this month and in all, and the last payments with a link to each transaction. Payments per page link to the transaction on Base; prepaid ones are marked prepaid until they are paid out.

Be found

“List my site in the P2Flux directory” is ticked by default. Listed: your site name, tagline, address, price, and the titles of your ten latest paid posts. Untick it and the listing is removed. Agents search the directory at GET /x402/directory.

Caches and CDNs

A cache that stores whole pages can answer an agent with a paid post before WordPress runs. Press Check my setup on the settings page: it opens your newest paid post the way a person does and then the way an AI agent does, through whatever stands in front of your site, and says whether the agent was asked to pay.

If you useDo this
WP RocketNothing. The plugin tells it to skip AI agents.
WP Super CacheSettings → WP Super Cache → Advanced → “Rejected User Agents”: add the agent names below, one per line.
W3 Total CachePerformance → Page Cache → “Rejected user agents”: add the agent names.
LiteSpeed CacheLiteSpeed Cache → Cache → Excludes → “Do Not Cache User Agents”: add the agent names.
Cloudflare (only if you cache HTML, “Cache Everything”)Caching → Cache Rules → new rule, “Bypass cache”, with the expression below.
Any other CDN or host cacheBypass the cache when the User-Agent contains one of the agent names, or exclude your paid posts from it.
Agent names
GPTBot
ChatGPT-User
OAI-SearchBot
ClaudeBot
Claude-User
anthropic-ai
PerplexityBot
CCBot
Bytespider
Amazonbot
meta-externalagent
python-requests
aiohttp
axios
node-fetch
curl
x402
P2Flux-MCP
Cloudflare cache rule
(http.user_agent contains "GPTBot") or (http.user_agent contains "ChatGPT-User") or (http.user_agent contains "ClaudeBot") or (http.user_agent contains "Claude-User") or (http.user_agent contains "PerplexityBot") or (http.user_agent contains "CCBot") or (http.user_agent contains "python-requests") or (http.user_agent contains "curl/") or (http.user_agent contains "x402") or (http.user_agent eq "") or (any(http.request.headers.names[*] == "payment-signature"))

A default Cloudflare setup does not cache HTML pages and needs nothing.

Your own assistant

On WordPress 6.9 and later the plugin registers three abilities (the WordPress Abilities API), so an AI assistant you connected to your site — for example through the MCP Adapter plugin — can answer “what did AI agents pay me this month?” and “make this post cost 0.10”.

AbilityDoesWho may
p2flux-agent-paywall/get-earningsTotals for today, this month, all time, and the latest payments.Administrators
p2flux-agent-paywall/get-settingsWhat is paid, the price, the wallet, the mode.Administrators
p2flux-agent-paywall/set-post-priceSets one post’s or file’s price.Whoever may edit that post

For plugin developers

From 0.5.0 a membership plugin can sell a period instead of one page — a subscription — on top of the paywall: it prices the page, says what the payment buys, grants the access when the payment settles and answers with an access token the agent sends back on later requests. Tipster Script does this for its predictions: a free pick costs the agent price, a locked pick is unlocked by the tipster’s subscription at the price people pay.

HookSignatureDoes
p2flux_ap_price (filter)( $price, $post, $url )What a request costs an agent. Return a price such as "0.05", or null for free or already entitled.
p2flux_ap_requirement (filter)( $required, $price, $url )The HTTP 402 before it is sent. Only resource (for example description, what the payment buys) can be changed; what is settled cannot.
p2flux_ap_paid (action)( $payment )A payment settled, before the content is served. Keys: price, units, url, post_id, payer, tx, network, scheme, agent.
P2Flux_AP_Gate::access_tokens()The tokens the agent sent in the P2Flux-Access-Token request header (base64url, 43 characters, up to 10).
p2flux_ap_agent_signatures (filter)( $signatures )The user-agent substrings treated as AI agents.

A worked example, a membership in one file. The three hooks price the page, say what the payment buys, and issue an access token when it settles:

my-agent-membership.php
<?php
// Agents pay 5 USDC once and then read every post in "members" for 30 days.

function my_agent_entitled() {
    $issued = (array) get_option( 'my_agent_tokens', array() );
    foreach ( P2Flux_AP_Gate::access_tokens() as $token ) {
        if ( ( $issued[ hash( 'sha256', $token ) ] ?? 0 ) > time() ) {
            return true;
        }
    }
    return false;
}

add_filter( 'p2flux_ap_price', function ( $price, $post, $url ) {
    if ( ! has_category( 'members', $post ) ) {
        return $price;                                   // everything else as set up
    }
    return my_agent_entitled() ? null : '5.00';          // null: read without paying
}, 10, 3 );

add_filter( 'p2flux_ap_requirement', function ( $required, $price, $url ) {
    $post = get_queried_object();
    if ( $post instanceof WP_Post && has_category( 'members', $post ) ) {
        $required['resource']['description'] = '30 days of every members post. '
            . 'Send the P2Flux-Access-Token you get back on later requests.';
    }
    return $required;
}, 10, 3 );

add_action( 'p2flux_ap_paid', function ( $payment ) {
    if ( ! $payment['post_id'] || ! has_category( 'members', $payment['post_id'] ) ) {
        return;
    }
    $token  = rtrim( strtr( base64_encode( random_bytes( 32 ) ), '+/', '-_' ), '=' );  // 43 characters
    $until  = time() + 30 * DAY_IN_SECONDS;
    $issued = (array) get_option( 'my_agent_tokens', array() );
    $issued[ hash( 'sha256', $token ) ] = $until;        // keep only the hash
    update_option( 'my_agent_tokens', $issued, false );
    header( 'P2Flux-Access-Token: ' . $token );
    header( 'P2Flux-Access-Expires: ' . gmdate( DATE_ATOM, $until ) );
} );
  • The agent sends tokens back in one P2Flux-Access-Token request header, separated by commas. P2Flux_AP_Gate::access_tokens() returns at most 10, each exactly 43 base64url characters; anything else is dropped. Store a hash, never the token.
  • P2Flux-Access-Expires (a date such as 2026-11-01T23:59:59+00:00) is optional. The P2Flux MCP server keeps a token until then; without it, for one day.
  • Every answer to an agent is sent with no-cache headers, pages also with Vary: User-Agent, PAYMENT-SIGNATURE, P2Flux-Access-Token, so a page opened by a token is not served to anyone else.
  • Return null from p2flux_ap_price only for content you would show that agent anyway: the page is then served without payment.

The P2Flux MCP server (0.3.0 and later) keeps such tokens per site and sends them back only to that site.

Tipster Script

Tipster Script 2.0.48 and later sells predictions to AI agents through this plugin. People and their subscriptions are not affected.

  • Install Agent Paywall (0.5.0 or later), save your wallet, and choose Test or Live.
  • Its Price per request is what an agent pays for one free pick.
  • Give each tipster a subscription plan priced in days with a USDC price — the plan’s own USDC price, or its price at your exchange rate. That is what agents pay for paid picks.
  • Tipster Script settings, section AI agents: choose whether AI agents pay for free picks. Yes is the default.
PickWhat an agent pays
Free pick, setting YesThe Agent Paywall price, per pick.
Free pick, setting NoNothing. Free picks stay free for agents too.
Paid pickThe tipster’s subscription: the cheapest day plan, at the USDC price people pay, for the same number of days. It is not renewed.
Private pickNever sold.

A paid pick that is already open to visitors, after kickoff or its result, counts as a free pick.

A subscription bought by an agent is recorded like one bought by a person, under one user per paying wallet, so tipster earnings, subscriber counts and reports include it. The answer carries a P2Flux-Access-Token; an agent that sends it back reads every pick of that tipster until the end date without paying. A tipster with no USDC day plan has no paid picks for sale to agents.

In lists, feeds and archives an agent sees only the picks it paid for or holds a subscription for (and free picks, with the setting on No). For the others the selection, odds, stake and analysis are left blank.

Limits

  • A bot that presents itself as an ordinary browser and does not sign its requests is not recognised and reads as a person does.
  • A full-page cache or CDN that answers before WordPress runs can serve a paid post to an agent — see “Caches and CDNs”.
  • Files are paid only when they have their own price, and on nginx only with the rule above.
  • If P2Flux cannot be reached, agents are asked to come back later (or read free, if you chose so). People are never affected.

What is sent to P2Flux

  • When an agent opens a paid page: your wallet address and the price.
  • When an agent pays: your wallet address, the price, the page address and the agent’s payment.
  • When you save the settings: your wallet address, and — if listed — your site address.

When an agent that signs its requests pays, the plugin reads that agent’s public keys from the agent’s own site, to check the signature. That request goes to the agent’s site, not to P2Flux.

Nothing about your human visitors is sent.

Something more than a standard integration?
Marketplace flows, platform billing and custom settlement logic.
Discuss an integration