/install x402-pay
x402 — HTTP-Native Payments
x402 gates API resources behind USDC micropayments using HTTP 402 Payment Required.
Step 0: Setup
Before running any script, install dependencies in the skill directory (once per environment):
cd \x3Cskills-dir>/x402-pay
npm install
No API keys required.
Step 1: Detect your wallet
Read references/detecting-wallets.md to choose which wallet to use. Once you've picked one, return here and continue from Step 2.
Step 2: Is the Service Known?
If you already have a specific service URL in mind that returned 402 payment required, skip straight to Step 3: Get the Service Details.
Otherwise continue to Step 2a: Find a Service
Step 2a: Find a Service
List all available services from x402-list and pick the most appropriate one:
node scripts/search-services.mjs search
If nothing suitable is found, try the Coinbase bazaar:
node scripts/search-services.mjs search \x3Ckeyword> --source bazaar
If still nothing, search the internet for x402 services matching the user's need.
Step 3: Get the Service Details
Once you have a service URL, get its full details (schemas, parameters, examples):
node scripts/search-services.mjs details \x3Cresource-url>
Then preview the live price — this reads the 402 challenge without paying and is wallet-independent:
node scripts/check-price.mjs \x3Curl> [--method GET|POST] [--body '{"key":"value"}']
Note this price: you'll use it in Step 4 to check whether your balance is sufficient (and, if funding, how much to deposit), and show it to the user before paying in Step 5.
Example working service
https://x402.ottoai.services/crypto-news
Step 4: Check Balance
Check your wallet's USDC balance on Base — see references/wallet-flows.md for the method for your wallet (if you don't already know it) — and compare it against the price you previewed in Step 3.
- Balance ≥ service price → proceed to Step 5
- Balance \x3C service price → fund it: Read
references/near-intents-funding.mdfor the cross-chain funding flow. Always use NEAR intents to fund the wallet if the balance is low. If the user has no crypto to swap from, the onramp path (references/onramp-funding.md) funds the wallet from Cash App / Robinhood / Revolut.
Gas: No ETH needed — you sign off-chain only. The x402 facilitator submits the on-chain transaction and covers gas. This applies to all wallet types.
Step 5: Pay
Always show the price before paying. Confirm with user before paying.
Show the user the price you previewed in Step 3 (if significant time has passed, re-run check-price.mjs in case it changed). Always get their confirmation before paying — for any amount. Then pay the endpoint using your wallet — see references/wallet-flows.md for the method for your wallet (if not already known).
Step 6: Confirm
Report the response body and any transaction hash to the user.
Rules
- Always ask the user before executing any command. Show the exact command you intend to run and wait for explicit approval before running it — this applies to wallet, payment, and funding commands.
- Abide by configured safeguards such as wallet spend limits and allowlists.
- When funding, always confirm the refund destination (address, chain, and origin-chain vs. NEAR Intents balance) with the user before any deposit.
- Never pay silently — always show the decoded price first
- Confirm with user before any payment
- Always report the tx hash after a successful payment
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install x402-pay - After installation, invoke the skill by name or use
/x402-pay - Provide required inputs per the skill's parameter spec and get structured output
What is x402 pay?
A skill for making HTTP 402 (x402) micropayments in USDC on Base. It can be funded cross-chain via NEAR Intents or from onramps like Cash App, Revolut, and Robinhood. Designed to be compatible with multiple agent wallet setups. It is an AI Agent Skill for Claude Code / OpenClaw, with 36 downloads so far.
How do I install x402 pay?
Run "/install x402-pay" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is x402 pay free?
Yes, x402 pay is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does x402 pay support?
x402 pay is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created x402 pay?
It is built and maintained by Owen (@pivortex); the current version is v1.0.1.