Browser extension

Payer-side payer-side adaptor tested — L1→L4 payer-side

The consumer side of the rail — an MV3 adaptor that auto-pays x402 paywalls and tips creators on the user's behalf.

What gets metered

a paid fetch — the extension's service worker hosts a PayerAgent; fetchWithPaywall sends a signed proof and, on a 402 Payment Required, grants on-chain and retries once. It's the payer for everything the creator-side integrations meter.

Attach surface — no fork

Nothing on any platform at all — this is Pattern 6, the consumer/payer-side adaptor. Three modes: bundle it as a library, message one installed host extension (chrome.runtime.onMessageExternal), or use the injected window.universalPaywall page bridge.

Quickstart

Bundle it, or talk to the installed host extension from any other extension:

// library mode — your extension's background service worker:
import { createPayerAgent } from '@universal-paywall/agent'
const agent = createPayerAgent({
  rpcUrl, chainId, account,           // injected account — never a raw key
  stakeVaultFactory: '0x…', usdc: '0x…',
})
const res = await agent.fetchWithPaywall(url, init)

// host/bridge mode — from ANY other extension:
chrome.runtime.sendMessage(UP_EXTENSION_ID,
  { type: 'up:fetch', url, init },    // → paid Response back
  (paidResponse) => { /* … */ })

All values above are placeholders — supply your own facilitator, wallets, and rate. The shared prerequisites (a deployed StakeVaultFactory, a running facilitator, a wallet registry) are covered in the admin overview.

Verify

npm run e2e:anvil -w @universal-paywall/extension

Drives the real payer loop through the extension handler + bridge against a real x402 resource: upFetch → 402 → auto vault/deposit/grant → 200 → facilitator settle → creator paid 50000 on-chain.

Notes & caveats

Links

← All integrations