Pay For Service — 技能工具
v0.1.0Access paid API endpoints and content using the x402 payment protocol. Use when you or the user want to call a paid API, access gated content, make an x402 p...
详细分析 ▾
运行时依赖
版本
Initial release of pay-for-service-2 skill. - Enables access to paid API endpoints and gated content using the x402 payment protocol. - Supports one-step payment and content retrieval with getX402Content, and separate payment authorization with authorizePayment. - Allows payment from multi-chain, multi-asset Finance District wallet (not limited to Base/USDC). - Includes flows for authentication, balance checking, payment authorization, and error handling. - User instructions and command examples provided for fetching and paying for resources.
安装命令 点击复制
技能文档
Use the Finance District wallet to access paid API endpoints and gated content via the x402 HTTP payment protocol. The wallet handles payment authorization and signing automatically — the agent fetches the content in a single call.
How x402 Works
x402 is an HTTP-native payment protocol:
- A server returns HTTP 402 with payment requirements
- The wallet signs a payment and retries the request with a payment header
- The facilitator verifies and settles the payment
- The server returns the content
The Finance District wallet supports x402 payments on multiple chains and assets, not just a single network.
Confirm wallet is authenticated
fdx status
If the wallet is not authenticated, refer to the authenticate skill.
Check Balance
Ensure the wallet has sufficient funds to cover the payment:
fdx call getWalletOverview
Fetching Paid Content
getX402Content — Fetch content from a paid endpoint
The primary command for accessing x402 resources. It discovers payment requirements, authorizes payment, and retrieves the content in one step:
fdx call getX402Content --url
Parameters
| Parameter | Required | Description |
|---|---|---|
--url | Yes | The x402-enabled endpoint URL |
--preferredNetwork | No | Preferred chain ID for payment (e.g. 8453 for Base) |
--preferredNetworkName | No | Preferred chain name (e.g. base, ethereum) |
--preferredAsset | No | Preferred payment asset (e.g. USDC) |
--maxPaymentAmount | No | Maximum payment amount to authorize |
authorizePayment — Pre-authorize a payment
For cases where you want to inspect payment requirements or authorize without fetching:
fdx call authorizePayment --url
Parameters
Same as getX402Content.
Examples
# Fetch content from a paid API (auto-discovers requirements and pays)
fdx call getX402Content \
--url https://api.example.com/premium/data# Prefer paying with USDC on Base
fdx call getX402Content \
--url https://api.example.com/premium/data \
--preferredNetworkName base \
--preferredAsset USDC
# Set a max payment cap
fdx call getX402Content \
--url https://api.example.com/premium/data \
--maxPaymentAmount 1000000
# Just authorize without fetching
fdx call authorizePayment \
--url https://api.example.com/premium/data
Flow
- Check authentication with
fdx status - Check wallet balance with
fdx call getWalletOverview - Call
fdx call getX402Content --urlto fetch paid content - If the payment amount seems high, use
fdx call authorizePaymentfirst to inspect, then confirm with the human before proceeding - Return the fetched content to the human
Important: Always inform your human about the payment before executing, especially for unfamiliar endpoints or amounts that seem high. Let them confirm they want to proceed.
Difference from Coinbase x402
The Finance District wallet supports multi-chain and multi-asset x402 payments. You can specify a preferred network and asset, giving flexibility to pay from whichever chain and token has available balance. Coinbase's implementation is limited to Base USDC.
Prerequisites
- Must be authenticated (
fdx statusto check, seeauthenticateskill) - Wallet must have sufficient balance in the required payment asset on the required network
- If insufficient funds, suggest using the
fund-walletskill orswap-tokensskill
Error Handling
- "Not authenticated" — Run
fdx setupfirst, or seeauthenticateskill - "Insufficient balance" — Check balance; see
fund-walletskill - "No x402 payment requirements found" — The URL may not be an x402-enabled endpoint
- "Payment failed" — May be a network issue; retry or try a different preferred network
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制