second-state/x402-skill/x402
Claude Code and agent skill by second-state/x402-skill
- community
Checking that the SKILL.md file is still in the repository.
Handle HTTP 402 Payment Required responses using x402 protocol
Install
npx vskill@latest install second-state/x402-skill/x402SKILL.md
x402 Payment Skill
When an HTTP request returns 402 Payment Required with x402 payment info, automatically retry using x402curl.
Detection
Only activate when all of the following are true:
- HTTP status code is
402 - At least one of:
- Response contains an
X-Paymentheader - Response body contains
"x402Version"in JSON
If a 402 response lacks these markers, inform the user it requires payment but do not retry — it is not an x402 endpoint.
Workflow
Step 1: Inform the user (one line):
This endpoint requires payment via x402. Retrying with x402curl...
Step 2: Transform the original curl command into an x402curl command.
Replace curl with {baseDir}/scripts/x402curl and adjust flags:
Preserve these flags as-is: -X, -H, -d, --data, --data-binary, -o, -F, -u, -L, -f
Drop these flags (x402curl manages its own output): -v, --verbose, -s, --silent
Step 3: Execute and return the result. On success, show the response without mentioning payment again.
Error Handling
Map x402curl exit codes to user-friendly messages:
| Exit code | Meaning | Message | |
|---|---|---|---|
| 1 | General error | "x402curl encountered an unexpected error. Run with --verbose to see details." | |
| 2 | Network error | "Could not reach the payment network. Check your internet connection and try again." | |
| 3 | Insufficient funds | "Payment failed: insufficient funds. Your wallet needs USDC on Base network. Testnet: get funds from https://www.alchemy.com/faucets/base-sepolia — Mainnet: transfer USDC to your wallet on Base." | |
| 4 | HTTP error | "The server returned an error after payment. The API may have changed requirements or be temporarily unavailable." | |
| 5 | Config error | "Wallet configuration error. Follow install.md to fix your setup." | |
| 6 | RPC error | "Could not query wallet balance. The RPC endpoint may be unavailable. Try again or use --x402-rpc-url to specify a custom endpoint." |
Balance Check
When a user asks to check their wallet balance:
Step 1: Run with defaults (Base mainnet USDC):
Step 2: Show the result to the user.
Step 3: Ask: "Would you like to check a balance on a different network or token?"
If yes, ask for the RPC URL and token contract address. Then run:
Examples
Simple GET
POST with JSON body
File upload
Output to file
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingopenclaw/skills/x402/SKILL.md
Popularity
- Repository stars
- 7
- Repository forks
- 4
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/second-state/x402-skill/x402)