/x402-payment-modal-kit:x402-modal-integrationfrom x402-payment-modal-kit
Integrates the @three-ws/x402-payment-modal into a web app: browser modal, React hook/button, and Express or Vercel Solana checkout route. Use when users must pay an x402 endpoint in USDC or $THREE on Solana from their wallet.
Ships in x402-payment-modal-kit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This plugin is a skill only. There is no MCP server. @three-ws/x402-payment-modal ships a browser modal, React bindings and the server helpers for the Solana checkout.
npm install @three-ws/x402-payment-modal
import { configure, pay, init } from '@three-ws/x402-payment-modal';
configure({ checkoutOrigin: null, checkoutPath: '/api/x402-checkout', theme: 'auto' });
const out = await pay({
endpoint: '/api/paid/summarize',
method: 'POST',
body: { text: 'hello' },
merchant: 'Acme',
action: 'Summarize',
caps: { maxPerCall: 100000, maxPerDay: 2000000 },
});
// out: { ok: true, result, payment?: { network, transaction, payer }, siwx?, response }
pay(opts) needs endpoint. Other options: method, body, headers, merchant, action, autoConnect, caps (micro-USD, enforced per wallet in localStorage).configure keys: checkoutOrigin, checkoutPath (default /api/x402-checkout), brand, footerNote, builderCode, esm, theme (auto, light, dark), cssVars.init() binds [data-x402-endpoint] elements. A prebuilt script is exported as @three-ws/x402-payment-modal/min.USDC_MINT_SOLANA and THREE_MINT for the two main Solana assets.import { X402Button, useX402 } from '@three-ws/x402-payment-modal/react';
<X402Button endpoint="/api/paid/summarize" method="POST" body={{ text: 'hi' }}
label="Pay and run" onResult={(r) => console.log(r.result)} onError={console.error} />
useX402(defaults) returns { pay, status, result, error, reset, isPaying }, where status is idle, paying, done or error. react is a peer dependency (17 or newer).
The Solana path posts to /api/x402-checkout?action=prepare and ?action=encode on your server. Mount one of the adapters:
// Express
import { x402CheckoutRouter } from '@three-ws/x402-payment-modal/server/express';
app.use(express.json());
app.use('/api/x402-checkout', x402CheckoutRouter({ rpcUrl: process.env.SOLANA_RPC_URL }));
// Vercel or Next.js pages API, api/x402-checkout.js
export { default } from '@three-ws/x402-payment-modal/server/vercel';
Options for both: rpcUrl, rpcUrls (failover), devnetRpcUrl, devnetRpcUrls, logger, origin (CORS, default *, tighten it to your own origin). The express adapter needs @solana/web3.js and @solana/spl-token peers.
To build the 402 challenge on the paid endpoint, import solanaAccept({ token: 'usdc' | 'three', payTo, feePayer, amount }) from @three-ws/x402-payment-modal/server.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub nirholas/x402-payment-modal --plugin x402-payment-modal-kit