TransX402 Docs
Integrations

WordPress Plugin

Complete guide to the TransX402 WordPress plugin — set up IDRX paywalls on your WordPress site without writing any code.

Overview

The TransX402 WordPress plugin enables site owners to monetize content with IDRX micropayments — no coding required. Just install the plugin, enter your API key, set prices in IDR, and toggle paywalls on individual posts or pages.

This is the first x402 plugin in the WordPress ecosystem — no other x402 WordPress plugin exists yet.

Requirements

  • WordPress 6.0+
  • PHP 8.0+
  • A TransX402 account with an API key (register at dashboard.transx402.com)

Installation

From WordPress Admin

  1. Go to Plugins > Add New in the WordPress admin
  2. Search for "TransX402 Paywall"
  3. Click Install then Activate

Manual Upload

  1. Download the plugin ZIP file from GitHub releases
  2. Go to Plugins > Add New > Upload Plugin
  3. Select the ZIP file and click Install Now
  4. Activate the plugin

Configuration

Main Settings

Go to Settings > TransX402 in the WordPress admin:

SettingDescription
API KeyTransX402 API key (ipk_sandbox_... or ipk_live_...)
Default Price (IDR)Default price for paywalled content (e.g., 5000)
Preview LengthFirst paragraph / First 200 words / Custom excerpt
Paywall StyleOverlay / Inline / Blur
Custom MessageCustom message on the paywall
Enable forPosts / Pages / Custom post types

Note: Wallet address, network, and facilitator URL are configured on the TransX402 dashboard — the plugin only needs the API key. This keeps the WordPress setup minimal.

Per-Post/Page Configuration

In the post/page editor sidebar, you'll see the TransX402 metabox:

SettingDescription
Enable PaywallToggle to enable paywall for this content
Price (IDR)Override the default price (optional)
Preview ContentCustom preview text (optional)

How It Works

For Visitors (Frontend)

  1. Visitor opens a paywalled article
  2. Sees the article preview (first paragraph or excerpt) plus the paywall overlay
  3. Clicks "Pay with IDRX"
  4. Connects wallet (MetaMask, Coinbase Wallet, etc.)
  5. First time only: approve Permit2 for IDRX (one-time, clearly explained)
  6. Signs the payment authorization (gasless, no ETH needed)
  7. Article unlocks immediately
  8. Return visits to the same article are free (payment remembered via localStorage and verified on-chain)

Content Gating

The plugin hooks into WordPress's the_content filter:

// Full content is NEVER sent to the browser for paywalled posts
// PHP truncates content at the preview boundary and injects the paywall overlay
// After payment, the JS library fetches full content via the REST API

This means your premium content is secure — it cannot be accessed by disabling JavaScript or viewing the HTML source.

Paywall Styles

Overlay (Default)

Content blurred behind a centered payment card. This is the most popular choice.

Inline

Paywall card appears inline after the preview content. Suitable for layouts that need a more integrated look.

Blur

Full content is visible but blurred, with a floating payment button. Creates a strong "teaser" effect.

WordPress REST API Endpoints

The plugin registers several WordPress REST API endpoints:

GET /wp-json/transx402/v1/content/:postId

Returns full post content after payment verification.

Required headers:

X-TransX402-TxHash: 0x...
X-TransX402-Payer: 0xPayerAddress

Verification flow:

  1. Check transaction hash against the TransX402 API (/verify/:txHash)
  2. Verify the payment recipient matches the site's wallet
  3. Verify the payment amount matches the post's price
  4. Return the full post content

GET /wp-json/transx402/v1/config

Returns the site's TransX402 configuration for the JS library:

{
  "apiKey": "ipk_live_...",
  "defaultPrice": 5000,
  "currency": "IDR"
}

GET /wp-json/transx402/v1/post/:postId/requirements

Returns payment requirements for a specific post (x402 format):

{
  "scheme": "permit2",
  "network": "base",
  "token": "0x18Bc5bcC660cf2B9cE3cd51a404aFe1a0cBD3C22",
  "maxAmountRequired": "5000000000000000000000",
  "resource": "https://example.com/wp-json/transx402/v1/content/123",
  "description": "Article: How to Build on Base"
}

Payment Verification and Access

After payment, the reader's access is stored in two places:

  1. Browser localStoragetransx402_paid_{postId} = transaction hash (instant, no server round-trip on return visits)
  2. Server-side verification — When fetching content, the transaction hash is verified against the blockchain/facilitator API

This means:

  • Return visits are instant (localStorage check)
  • Clearing browser data requires re-verification (but payment is still on-chain, so a "restore purchases" flow is possible)
  • Different devices require the same wallet to sign a free verification message

Compatibility

ComponentSupport
WordPress6.0+
PHP8.0+
EditorGutenberg, Classic Editor
ThemesAstra, GeneratePress, OceanWP, and other popular themes
WooCommerceNot required, but compatible
Caching pluginsWP Super Cache, W3 Total Cache (paywall overlay is JS-rendered, full content fetched via API)
SEOPreview content is indexable by search engines. Full content is behind an API call.

Testing with Sandbox

  1. Enter a sandbox API key (ipk_sandbox_...) in the plugin settings
  2. The plugin automatically connects to the sandbox environment
  3. Make test payments using free test IDRX
  4. Once satisfied, switch to a production API key (ipk_live_...)

No need to change any other configuration — just swap the API key.

Security

  • Full post content is never in the initial HTML — it's fetched via REST API after payment verification
  • Payment verification happens server-side (PHP calls the facilitator API)
  • Wallet address validation on admin settings save
  • Nonce protection on admin forms
  • REST API endpoints use WordPress nonce + payment verification
  • No sensitive data stored in the WordPress database (no private keys, no payment signatures)