← 返回
开发者工具 中文

Pay For Service

Access 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...
{"answer": "使用 x402 支付协议访问付费 API 端点和内容。"}
rachidjarray-hk-qa-fdt
开发者工具 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 664
下载
💾 0
安装
1
版本
#latest

概述

Paying for Services (x402)

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:

  1. A server returns HTTP 402 with payment requirements
  2. The wallet signs a payment and retries the request with a payment header
  3. The facilitator verifies and settles the payment
  4. 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 <endpoint-url>

Parameters

ParameterRequiredDescription
-------------------------------------------------------------------------------------
--urlYesThe x402-enabled endpoint URL
--preferredNetworkNoPreferred chain ID for payment (e.g. 8453 for Base)
--preferredNetworkNameNoPreferred chain name (e.g. base, ethereum)
--preferredAssetNoPreferred payment asset (e.g. USDC)
--maxPaymentAmountNoMaximum 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 <endpoint-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

  1. Check authentication with fdx status
  2. Check wallet balance with fdx call getWalletOverview
  3. Call fdx call getX402Content --url to fetch paid content
  4. If the payment amount seems high, use fdx call authorizePayment first to inspect, then confirm with the human before proceeding
  5. 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 status to check, see authenticate skill)
  • Wallet must have sufficient balance in the required payment asset on the required network
  • If insufficient funds, suggest using the fund-wallet skill or swap-tokens skill

Error Handling

  • "Not authenticated" — Run fdx setup first, or see authenticate skill
  • "Insufficient balance" — Check balance; see fund-wallet skill
  • "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

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-30 23:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 65 📥 179,689
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 666 📥 323,652
security-compliance

Authenticate

rachidjarray-hk-qa-fdt
登录 Finance District 代理钱包。当您或用户想要登录、连接、设置或配置钱包时使用。
★ 0 📥 588