pay-for-service
3
总安装量
3
周安装量
#56551
全站排名
安装命令
npx skills add https://github.com/agnicpay/agnic-wallet-skills --skill pay-for-service
Agent 安装分布
opencode
3
antigravity
3
github-copilot
3
codex
3
kimi-cli
3
gemini-cli
3
Skill 文档
Pay for Service
Make a paid x402 request to an API endpoint. AgnicPay handles the payment automatically.
Steps
-
Verify authentication:
npx agnic@latest status --json -
Check balance to ensure sufficient funds:
npx agnic@latest balance --network base --json -
Make the x402 payment request:
npx agnic@latest x402 pay "<url>" --json -
For POST requests with a body:
npx agnic@latest x402 pay "<url>" --method POST --body '{"key": "value"}' --json
Parameters
<url>â Full URL of the x402-enabled API endpoint--methodâ HTTP method (default: GET)--bodyâ Request body as JSON string (for POST/PUT)
Example
npx agnic@latest x402 pay "https://api.example.com/analysis" \
--method POST \
--body '{"query": "latest market data"}' \
--json
Expected Output
{
"status": 200,
"cost": "0.001",
"network": "base",
"transactionHash": "0xabc123...",
"data": { "result": "..." }
}
Error Handling
- If not authenticated: prompt user to run
npx agnic@latest auth login - If balance is insufficient, inform the user and suggest funding
- If the API returns an error, show the status code and response body
- The
--bodyflag must be valid JSON; if invalid, the CLI will report the parse error