CardZero Payment Wallet
Beta — Smart contract audit in progress. Recommended wallet balance: < $100 USDC.
You have a CardZero payment wallet on Base (Coinbase L2). This wallet holds USDC and lets you make on-chain payments within rules set by your Owner (the human who manages your wallet).
Capabilities
- 1. Create a new wallet — Register a wallet for your Owner to claim
- Check balance — Query your current USDC balance
- Make payments — Send USDC to any address (merchants, services, or other agents)
- Pay x402 paywalls — Automatically pay for HTTP 402-protected resources
- Agent-to-agent payments — Pay another CardZero agent directly by their wallet address
- View payment history — See recent transactions
Authentication
All endpoints except Create Wallet require your API Key:
CODEBLOCK0
You receive this API Key from your Owner after they claim the wallet. Store it as CARDZERO_API_KEY.
Wallet Lifecycle
A wallet goes through two stages:
- 1. You create it → You get a
walletId and a one-time claimKey (no API Key needed) - Your Owner claims it → They get an API Key and give it to you as an Agent Configuration block
- You start operating → Use the API Key for all subsequent requests
Until your Owner claims the wallet and gives you the API Key, you cannot make payments or check balance.
Agent Configuration
After claiming, your Owner will give you a block like this:
CODEBLOCK1
When you receive this, extract and save:
- -
CARDZERO_API_KEY — the API Key (starts with czapi_) - INLINECODE5 — the wallet ID
- INLINECODE6 — the API base URL
Rules
Before every payment
- - Tell the user the amount, recipient address, and reason before sending
- If the user hasn't confirmed, ask for confirmation first
When something goes wrong
- -
INSUFFICIENT_BALANCE → Tell the user your balance is too low and suggest they add funds - INLINECODE8 → Tell the user your wallet has been frozen by the Owner and you cannot make payments until they unfreeze it
- INLINECODE9 → This is rare — session keys are auto-managed by CardZero. If this persists, ask the Owner to contact support
- INLINECODE10 → The wallet hasn't been claimed yet; remind the user to claim it with the claimKey you provided
- INLINECODE11 → Your API Key is invalid or has been revoked; ask the Owner to check
Spending limits
Your Owner may set per-transaction and daily spending limits. If a payment exceeds these limits, the chain will reject it. When this happens, explain the limit to the user and suggest a smaller amount.
Config Summary
Your Owner may paste a
Config Summary block that looks like this:
CODEBLOCK2
When you receive this, parse it to understand your current spending context. Use the limits to proactively check before attempting a payment that would fail.
API Reference
Base URL: ${CARDZERO_API_URL}/v1
1. Create Wallet
No authentication required — this is the first step before you have an API Key.
CODEBLOCK3
Response (201):
CODEBLOCK4
After creating a wallet, you MUST:
- 1. Save the
id as your INLINECODE14 - Tell the Owner the
claimKey clearly — this is the only time it's shown - Tell the Owner the
chainAddress so they can send USDC to it - Explain: "Go to the CardZero Dashboard, enter this claim key, and set up your username and password to activate the wallet. The key expires in 7 days. After claiming, you'll get an Agent Configuration block — paste it back to me so I can start making payments."
Example message to Owner:
I've created a CardZero wallet for you. Here's what you need to do:
Wallet address: 0xa1f2...70D0
Claim key: czk_a1b2c3d4e5f6g7h8_i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2
Go to the CardZero Dashboard and enter this claim key to activate the wallet. The key is valid for 7 days and can only be used once. After claiming, you'll see an Agent Configuration block — copy it and paste it back to me so I can start making payments.
2. Check Balance
Requires API Key.
CODEBLOCK5
Response (200):
CODEBLOCK6
Errors:
- -
WALLET_NOT_ACTIVE — Wallet hasn't been claimed yet - INLINECODE20 — Invalid walletId
- INLINECODE21 — API Key is invalid or revoked
- INLINECODE22 — API Key is not bound to this wallet
3. Make Payment
Requires API Key. The wallet is automatically determined from your API Key — do NOT include walletId in the request body.
CODEBLOCK7
Response (201):
CODEBLOCK8
Fields:
- -
to — Recipient Ethereum address (0x-prefixed, 42 characters) - INLINECODE25 — USDC amount as a string (e.g. "2.50")
- INLINECODE26 — Must be INLINECODE27
- INLINECODE28 — Optional note for the payment
- INLINECODE29 — Optional; prevents duplicate charges if you retry
Important: Do NOT include walletId in the request body. Your API Key already identifies which wallet to use.
Errors:
- -
WALLET_NOT_FOUND — Invalid walletId - INLINECODE32 — Wallet hasn't been claimed
- INLINECODE33 — Owner froze the wallet
- INLINECODE34 — Not enough USDC
- INLINECODE35 — Internal signing key unavailable (auto-managed, rarely seen)
- INLINECODE36 — Only USDC is supported
- INLINECODE37 — On-chain transaction failed (may include "spend limit exceeded" for tx/daily limits)
- INLINECODE38 — API Key is invalid or revoked
After a successful payment, use remainingBalance to track your funds without a separate balance query.
Fee disclosure: A 2% service fee is automatically deducted from your wallet on each payment. For example, a $5.00 payment costs $5.10 total ($5.00 to the recipient + $0.10 fee). The fee is handled on-chain — you do not need to calculate or add it manually.
4. Pay for x402-Protected Resources
Requires API Key. Use this when you receive an HTTP 402 Payment Required response from a service that supports the x402 payment protocol.
CODEBLOCK9
Response (201):
CODEBLOCK10
Fields:
- -
url — The URL that returned 402 (stored as memo for records) - INLINECODE42 — Maximum USDC amount to pay
- INLINECODE43 — Merchant's Ethereum address (from the 402 response)
- INLINECODE44 — Chain identifier:
eip155:8453 (Base Mainnet) or eip155:84532 (Base Sepolia) - INLINECODE47 — USDC contract address (from the 402 response)
How to use x402:
- 1. Make your original HTTP request to the protected resource
- If you receive a
402 Payment Required response, extract recipient, maxAmount, network, and asset from the response headers/body - Call
POST /v1/x402/pay with those values plus the original INLINECODE54 - Take the
paymentHeader from the response - Retry your original request with the header: INLINECODE56
Errors: Same as Make Payment above, plus:
- -
UNSUPPORTED_NETWORK — Network not supported (must be Base) - INLINECODE58 — Only USDC is supported
5. View Payment History
Requires API Key.
CODEBLOCK11
Response (200):
CODEBLOCK12
Query parameters:
- -
limit — Number of records (default: 20, max recommended: 50) - INLINECODE60 — Skip N records for pagination
Payment status values: pending, confirmed, INLINECODE63
Errors:
- -
FORBIDDEN — API Key is not bound to this wallet
6. Check Payment Status
No authentication required — payment IDs are unguessable.
CODEBLOCK13
Returns the same shape as a single payment object from the history endpoint.
CardZero 支付钱包
测试版 — 智能合约审计进行中。建议钱包余额:< 100 USDC。
您在 Base(Coinbase L2)上拥有一个 CardZero 支付钱包。该钱包持有 USDC,并允许您在所有者(管理您钱包的人类)设定的规则内进行链上支付。
功能
- 1. 创建新钱包 — 注册一个钱包供您的所有者认领
- 查询余额 — 查询您当前的 USDC 余额
- 进行支付 — 向任何地址(商户、服务或其他代理)发送 USDC
- 支付 x402 付费墙 — 自动支付受 HTTP 402 保护的资源
- 代理间支付 — 通过钱包地址直接向其他 CardZero 代理支付
- 查看支付历史 — 查看近期交易
身份验证
除创建钱包外的所有端点都需要您的 API 密钥:
Authorization: Bearer czapixxxxxxxxyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
您的所有者在认领钱包后会向您提供此 API 密钥。请将其存储为 CARDZEROAPIKEY。
钱包生命周期
钱包经历两个阶段:
- 1. 您创建它 → 您获得一个 walletId 和一次性 claimKey(无需 API 密钥)
- 您的所有者认领它 → 他们获得一个 API 密钥,并以代理配置块的形式提供给您
- 您开始操作 → 在后续所有请求中使用该 API 密钥
在您的所有者认领钱包并向您提供 API 密钥之前,您无法进行支付或查询余额。
代理配置
认领后,您的所有者会向您提供如下配置块:
== CardZero 代理配置 ==
API 密钥: czapia1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4
钱包 ID: wallet_7370ee785775
API URL: https://api.cardzero.ai/v1
收到后,请提取并保存:
- - CARDZEROAPIKEY — API 密钥(以 czapi 开头)
- CARDZEROWALLETID — 钱包 ID
- CARDZEROAPI_URL — API 基础 URL
规则
每次支付前
- - 在发送前告知用户金额、收款地址和原因
- 如果用户尚未确认,请先请求确认
出现问题时
- - INSUFFICIENTBALANCE → 告知用户您的余额不足,建议他们添加资金
- WALLETFROZEN → 告知用户您的钱包已被所有者冻结,在解冻前无法进行支付
- NOSESSIONKEY → 这种情况很少见——会话密钥由 CardZero 自动管理。如果持续出现,请让所有者联系支持团队
- WALLETNOTACTIVE → 钱包尚未被认领;提醒用户使用您提供的 claimKey 进行认领
- INVALIDAPIKEY → 您的 API 密钥无效或已被撤销;请让所有者检查
消费限额
您的所有者可能设置每笔交易和每日消费限额。如果支付超过这些限额,链将拒绝该交易。发生这种情况时,请向用户解释限额并建议较小的金额。
配置摘要
您的所有者可能粘贴如下所示的
配置摘要块:
== CardZero 钱包摘要 ==
地址:0xff0A...6F9
状态:活跃
余额:142.50 USDC
规则:
- 每笔交易限额:5.00 USDC
- 每日限额:50.00 USDC
- 冻结:否
会话密钥:1 个活跃(最早过期 2026-03-18)
收到后,请解析它以了解您当前的消费环境。使用限额主动检查,避免尝试会导致失败的支付。
API 参考
基础 URL:${CARDZEROAPIURL}/v1
1. 创建钱包
无需身份验证 — 这是在您拥有 API 密钥之前的第一步。
POST /v1/wallets
Content-Type: application/json
{
name: 可选显示名称
}
响应(201):
json
{
id: wallet_7370ee785775,
chainAddress: 0xa1f2...70D0,
claimKey: czka1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2,
name: 我的代理钱包,
status: pending
}
创建钱包后,您必须:
- 1. 将 id 保存为您的 CARDZEROWALLETID
- 清晰告知所有者 claimKey——这是唯一一次显示该密钥
- 告知所有者 chainAddress,以便他们向该地址发送 USDC
- 解释:前往 CardZero 控制台,输入此 claim key,设置您的用户名和密码以激活钱包。该密钥在 7 天后过期。认领后,您将获得一个代理配置块——将其粘贴回给我,以便我开始进行支付。
给所有者的示例消息:
我已为您创建了一个 CardZero 钱包。以下是您需要执行的操作:
钱包地址: 0xa1f2...70D0
Claim key: czka1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6a7b8c9d0e1f2
前往 CardZero 控制台并输入此 claim key 以激活钱包。该密钥有效期为 7 天,且只能使用一次。认领后,您将看到一个代理配置块——将其复制并粘贴回给我,以便我开始进行支付。
2. 查询余额
需要 API 密钥。
GET /v1/wallets/{walletId}/balance
Authorization: Bearer {CARDZEROAPIKEY}
响应(200):
json
{
walletId: wallet_7370ee785775,
balance: 42.50,
currency: USDC
}
错误:
- - WALLETNOTACTIVE — 钱包尚未被认领
- WALLETNOTFOUND — 无效的 walletId
- INVALIDAPIKEY — API 密钥无效或已被撤销
- FORBIDDEN — API 密钥未绑定到此钱包
3. 进行支付
需要 API 密钥。 钱包将根据您的 API 密钥自动确定——请勿在请求体中包含 walletId。
POST /v1/payments
Content-Type: application/json
Authorization: Bearer {CARDZEROAPIKEY}
{
to: 0x1234567890123456789012345678901234567890,
amount: 2.50,
currency: USDC,
memo: API 访问支付,
idempotencyKey: 唯一密钥以防止重复
}
响应(201):
json
{
paymentId: pay_abc123def456,
status: confirmed,
txHash: 0xabc123...,
remainingBalance: 40.00,
amount: 2.50,
to: 0x1234567890123456789012345678901234567890
}
字段:
- - to — 收款人以太坊地址(以 0x 开头,42 个字符)
- amount — USDC 金额字符串(例如 2.50)
- currency — 必须为 USDC
- memo — 支付的可选备注
- idempotencyKey — 可选;防止重试时重复扣款
重要: 请勿在请求体中包含 walletId。您的 API 密钥已标识要使用的钱包。
错误:
- - WALLETNOTFOUND — 无效的 walletId
- WALLETNOTACTIVE — 钱包尚未被认领
- WALLETFROZEN — 所有者冻结了钱包
- INSUFFICIENTBALANCE — USDC 余额不足
- NOSESSIONKEY — 内部签名密钥不可用(自动管理,很少出现)
- UNSUPPORTEDCURRENCY — 仅支持 USDC
- CHAINERROR