Mag3nt Pay
/install mag3nt-pay
Mag3nt Pay
Pay for any API that returns HTTP 402 using Mag3nt virtual cards and USDC. Supports Base, Solana and most EVMs. Settles on Solana, Base and Tempo.
Preflight
Confirm credentials are set:
[[ -z "$MAG3NT_API_KEY" ]] && echo "ERROR: Set MAG3NT_API_KEY (starts with mag3nt_live_)" && exit 1
[[ -z "$MAG3NT_CARD_ID" ]] && echo "ERROR: Set MAG3NT_CARD_ID" && exit 1
[[ -z "$MAG3NT_CARD_TOKEN" ]] && echo "ERROR: Set MAG3NT_CARD_TOKEN" && exit 1
If credentials are missing, tell the user to visit mag3nt.com to create an account, generate an API key, and fund an agent card.
When to Activate
Activate this skill when ANY of these occur:
- An HTTP response has status code 402
- A response contains a
PAYMENT-REQUIREDheader - A response contains a
WWW-Authenticateheader withPayment request= - A response contains an
AP2-Challengeheader - A response body contains a
paylinkobject with acodefield - The user asks to "pay for", "buy access to", or "unlock" an API
- The user asks to check their Mag3nt balance or card status
How Payment Works
Mag3nt has one universal payment endpoint: POST https://mag3nt.com/api/pay
For x402, MPP, and AP2 protocols, you do NOT need to detect or decode the protocol yourself. Just pass the target URL and the engine auto-detects the protocol and settles on-chain.
For Pay Links (paylink object in 402 body), use POST https://mag3nt.com/api/pay/{code}/settle with card credentials. No API key required.
Protocol Detection and Routing
When you receive an HTTP 402, inspect the response in this order:
- Body contains
paylinkobject → Pay Link → readreferences/paylink-pay.md - Any protocol header (PAYMENT-REQUIRED, WWW-Authenticate, AP2-Challenge) → use the universal pay endpoint → read
references/x402-pay.md
Always check balance first. Read references/balance.md before any payment.
Reference Routing
| Task | Read This First |
|---|---|
| Set up credentials | references/setup.md |
| Check card balance | references/balance.md |
| Pay a Pay Link (most common, no API key needed) | references/paylink-pay.md |
| Pay any x402 / MPP / AP2 protected API | references/x402-pay.md |
| MPP-specific detection notes | references/mpp-pay.md |
| AP2-specific detection notes | references/ap2-pay.md |
Payment Flow
- Detect — Agent receives HTTP 402
- Check — Verify card balance >= required amount via
GET /api/cards - Pay — Call
POST /api/paywith{ card_id, card_token, url }(orPOST /api/pay/{code}/settlefor Pay Links) - Retry — Re-send the original request with the payment receipt header
Error Handling
- Insufficient balance (403): Tell the user the current balance and required amount. Suggest topping up at mag3nt.com.
- Card frozen or inactive: Tell the user to check their card status in the dashboard.
- Already settled (410): The payment was already made. Proceed directly to retrying the request.
- No payable option (422): The target URL does not offer any payment protocol. Tell the user.
- Network mismatch: Ensure the card's network matches what the merchant expects. The network is set when the card is created.
Important
- All payments are in USDC on the network configured for the card
- Card credentials never leave the local environment
- The agent should always confirm the payment amount with the user before paying amounts > $1.00
- Pay Links are the most common protocol — most merchants use them
- API base URL is
https://mag3nt.com(not api.mag3nt.com)
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install mag3nt-pay - 安装完成后,直接呼叫该 Skill 的名称或使用
/mag3nt-pay触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Mag3nt Pay 是什么?
Pay for any API that returns HTTP 402 Payment Required using Mag3nt virtual cards. Use when the agent encounters an HTTP 402 response, a paywall, a payment c... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 41 次。
如何安装 Mag3nt Pay?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install mag3nt-pay」即可一键安装,无需额外配置。
Mag3nt Pay 是免费的吗?
是的,Mag3nt Pay 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Mag3nt Pay 支持哪些平台?
Mag3nt Pay 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Mag3nt Pay?
由 mag3nt.com(@mag3nt)开发并维护,当前版本 v1.0.1。