Primer Pay for WordPress
Monetize any WordPress post or page with x402 micropayments. Tick a box, set a price, publish. Readers with the Primer Pay browser extension unlock content instantly — everyone else sees a teaser with an install prompt.
How it works
- You enable the paywall on a post and set a price (e.g. $0.01 USDC).
- A reader visits the post. WordPress serves the teaser and a small unlock container.
- Our JavaScript fires a fetch to the plugin's REST endpoint.
- If the reader has the Primer Pay browser extension, it intercepts the 402 response, signs a USDC payment, and retries transparently.
- The plugin validates the payment via the Primer facilitator, sets an HMAC-signed access cookie, and returns the unlocked content.
- Subsequent visits are served from the cookie — no re-payment on refresh.
Readers without the extension see a teaser with a "Get Primer Pay" call-to-action linking to the Chrome Web Store.
Install
zip Download latest release
Upload via wp-admin → Plugins → Add New → Upload Plugin. One-click install.
GitHub Source code
MIT-compatible open source. Clone, fork, contribute, or file issues on GitHub.
Requirements
- WordPress 5.8+ and PHP 7.4+
- A wallet address that can receive USDC payments on Base or SKALE Base (MetaMask, Coinbase Wallet, or the Primer Pay extension itself all work — same address works on all supported networks)
- HTTPS recommended — cookies are marked
Secureon HTTPS sites; HTTP still works for local development
Setup
- Install the plugin from the zip download above and activate it.
- Go to Settings → Primer Pay and enter your wallet address.
- Optionally adjust the default price, Access Duration, and Accepted Networks (Base, SKALE Base, or both — with a preferred-network priority).
- Edit any post, find the Primer Pay box in the sidebar, check Enable x402 Paywall, and publish.
Marking the teaser
Add the [x402] shortcode anywhere in your post content. Everything above it is the free teaser; everything below is the paid content:
This is the free preview everyone sees.
[x402]
This is the paid content only visitors who pay can read.
If you don't add [x402], the plugin falls back to the post's excerpt as the teaser.
Readers: how to pay
Install the free Primer Pay browser extension, fund it with USDC on Base, and browse normally. Paywalled content unlocks automatically — no logins, no forms, no checkout flow.
Supported networks
| Network | Chain ID | USDC Contract | Gas Fees |
|---|---|---|---|
| Base | 8453 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
< $0.001 |
| SKALE Base | 1187947933 | 0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20 |
Zero (gasless) |
Enable one or both in Settings → Primer Pay → Accepted Networks. When both are enabled, the preferred network is offered first; if the reader can't pay on it, the next is tried automatically. The same wallet address works on all networks.
Architecture highlights
REST-based unlock flow
Unlike naive x402 paywalls that return 402 on top-level navigation, Primer Pay serves paywalled posts as normal 200 OK pages and runs the x402 exchange via a background fetch() to a REST endpoint. This is compatible with:
- Hosts that insert interstitials or consent banners between the browser and the origin
- CDN bot-protection layers (Cloudflare, etc.)
- Browser content-script sandboxing (which blocks inline scripts in
document.write-delivered content) - Session cookies on unlock (which are discarded by the extension's navigation-path retry)
HMAC-signed access cookies
After a successful payment, the plugin sets an HttpOnly, HMAC-signed cookie scoped to that specific post. Subsequent visits within the configured duration skip the x402 dance entirely and serve the content directly. Cookies are:
- HMAC-SHA256 signed with a site-specific secret stored non-autoloaded in
wp_options - HttpOnly — not readable by JavaScript, preventing XSS exfiltration
- SameSite=Lax
- Verified in constant time via
hash_equals()
Non-custodial
The plugin never handles private keys or funds. The merchant provides only a receive address; signing happens entirely in the reader's browser extension. Settlement happens through the Primer facilitator, which charges nothing for Base network transactions.
Planned
- Gutenberg block for inline content gating with editor preview
- Earnings dashboard and payment history export
- WooCommerce integration for digital downloads
- Multi-network support
- SIWX wallet identity for cross-post access passes
- REST API and media-file gating for headless WordPress and gated downloads
Support
Issues and pull requests welcome at github.com/primer-systems/primer-pay-wordpress. For direct contact, email dev@primer.systems.