A2A Payments (APay)
Blockchain-native USDC payments for AI agents on Base chain. Pay for services, manage budgets, and handle micropayments.
Quick Start
Check your balance:
CODEBLOCK0
Pay a service:
CODEBLOCK1
Available Tools
Balance & Budget
| Tool | Description |
|---|
| INLINECODE0 | Check USDC balance, daily budget, spending limits |
| INLINECODE1 |
Verify if a specific amount is affordable |
|
apay_spending_history | Get spending analytics and history |
Payments
| Tool | Description |
|---|
| INLINECODE3 | Pay a service (agent pays gas) |
| INLINECODE4 |
Gasless signed payment (server submits on-chain) |
|
apay_estimate_cost | Estimate cost including 0.5% platform fee |
Services
| Tool | Description |
|---|
| INLINECODE6 | List available APay services |
| INLINECODE7 |
Get detailed service info |
Payment Channels (Streaming)
| Tool | Description |
|---|
| INLINECODE8 | Check channel status |
| INLINECODE9 |
Open channel with USDC deposit |
|
apay_stream_pay | Sign off-chain micropayment |
|
apay_stream_close | Close channel (refund unspent) |
x402 Protocol
| Tool | Description |
|---|
| INLINECODE12 | Fetch URL with automatic x402 payment on HTTP 402 |
Workflows
Pay for a tool execution
- 1.
apay_budget_check — verify affordability - INLINECODE14 — see total with fees
- INLINECODE15 — execute payment
- Receive payment receipt with tx hash
Streaming micropayments
For services that charge per-request (API calls, data feeds):
- 1.
apay_stream_open — deposit USDC into channel - INLINECODE17 — sign micropayments (off-chain, instant)
- INLINECODE18 — settle on-chain, refund remainder
x402 auto-payment
For services using the HTTP 402 payment protocol:
CODEBLOCK2
The tool automatically detects 402 responses, pays the required amount, and retries the request.
Network
- - Chain: Base (Coinbase L2)
- Stablecoin: USDC (6 decimals)
- Model: Escrow-based sessions with spending limits
- Testnet: base-sepolia for development
A2A 支付(APay)
基于区块链的原生USDC支付,专为Base链上的AI代理设计。支持服务付费、预算管理及小额支付处理。
快速入门
查询余额:
使用 apaycheckbalance 查看我的USDC余额
支付服务:
使用 apaypayservice,服务ID为svc-123,金额为0.50
可用工具
余额与预算
| 工具 | 描述 |
|---|
| apaycheckbalance | 查询USDC余额、每日预算及消费限额 |
| apaybudgetcheck |
验证特定金额是否可负担 |
| apay
spendinghistory | 获取消费分析与历史记录 |
支付
| 工具 | 描述 |
|---|
| apaypayservice | 支付服务费用(代理承担Gas费) |
| apaypaysigned |
无Gas签名支付(由服务器提交上链) |
| apay
estimatecost | 预估费用(含0.5%平台手续费) |
服务
| 工具 | 描述 |
|---|
| apaylistservices | 列出可用的APay服务 |
| apaygetservice |
获取详细服务信息 |
支付通道(流式支付)
| 工具 | 描述 |
|---|
| apaychannelstatus | 查询通道状态 |
| apaystreamopen |
存入USDC开通通道 |
| apay
streampay | 签署链下小额支付 |
| apay
streamclose | 关闭通道(退还剩余资金) |
x402协议
| 工具 | 描述 |
|---|
| apayx402fetch | 获取URL,遇到HTTP 402时自动进行x402支付 |
工作流程
支付工具执行费用
- 1. apaybudgetcheck — 验证可负担性
- apayestimatecost — 查看含手续费的总费用
- apaypayservice — 执行支付
- 接收包含交易哈希的支付收据
流式小额支付
适用于按请求计费的服务(API调用、数据订阅等):
- 1. apaystreamopen — 向通道存入USDC
- apaystreampay — 签署小额支付(链下即时完成)
- apaystreamclose — 链上结算,退还剩余资金
x402自动支付
适用于使用HTTP 402支付协议的服务:
使用 apayx402fetch,URL为https://api.example.com/premium/data,最大支付金额为1.00
该工具自动检测402响应,支付所需金额,并重新发起请求。
网络信息
- - 链:Base(Coinbase L2)
- 稳定币:USDC(6位小数)
- 模式:基于托管账户的会话,设有消费限额
- 测试网:base-sepolia(用于开发测试)