微算力 · API 导航与自营网关
API 接入 EN
未登录登录
💳

AI Agent 的自动支付钱包

payrail402 · v1.0.0
效率 安全 B 级 作者 rsquaredsolutions2026 公开目录收录
1k 下载 0 安装 3.5k 收藏 7 浏览

简介

基于 USDC 的 x402 支付钱包,支持 AI Agent 自动完成 API 付费调用与余额管理

原始描述

Cross-rail spend tracking for AI agents — Visa IC, Mastercard Agent Pay, Stripe ACP, x402, and ACH in one dashboard.

通过你的 Agent 添加

安装目录:payrail402/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/payrail402/
Codex CLI~/.codex/skills/payrail402/
DeepSeek Harness~/.agents/skills/payrail402/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文


name: payrail402 description: Manage x402 payment wallet - provision, fund, check balance, and pay for API calls automatically via Cloud.payrail402.com metadata: {"openclaw": {"emoji": "💳", "homepage": "https://cloud.payrail402.com", "primaryEnv": "PAYRAIL402_API_KEY", "requires": {"env": ["PAYRAIL402_API_KEY"]}}}

Payrail402 — x402 Payment Wallet for AI Agents

You have access to a Payrail402 wallet that lets you pay for x402 API calls automatically. The wallet holds USDC on Base and is managed via Cloud.payrail402.com.

Configuration

  • API Base URL: https://cloud.payrail402.com (or the value of PAYRAIL402_BASE_URL if set)
  • API Key: Available as PAYRAIL402_API_KEY environment variable

Setup (First-Time Provisioning)

If PAYRAIL402_API_KEY is not set, guide the user through wallet provisioning:

  1. Ask the user for their email address (required for account creation).
  2. Provision a wallet by calling the API:
curl -s -X POST https://cloud.payrail402.com/api/v1/provision \
  -H "Content-Type: application/json" \
  -d '{"name": "<agent-name>", "email": "<user-email>", "initialFundingUsd": 10}'

The response contains:

  • apiKey — save this immediately
  • agentId — the agent identifier
  • fundingUrl — a Stripe checkout link (if initialFundingUsd was set)
  • dashboardUrl — link to the management dashboard
  1. Store the API key in the OpenClaw config:
# Read existing config (or create empty)
CONFIG_FILE="$HOME/.openclaw/openclaw.json"
mkdir -p "$(dirname "$CONFIG_FILE")"

# Use jq to merge the key into skills.entries.payrail402
jq '.skills.entries.payrail402 = (.skills.entries.payrail402 // {}) + {"enabled": true, "apiKey": "<THE_API_KEY>"}' \
  "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
  1. Send the funding URL to the user so they can add funds via credit card. Tell them: "Click this link to fund your wallet. The balance updates automatically once payment completes."

  2. Remind the user they can also manage everything at their dashboard URL.

Checking Balance

Before making paid requests or when the user asks, check the wallet balance:

curl -s https://cloud.payrail402.com/api/v1/wallets/balance \
  -H "X-API-Key: $PAYRAIL402_API_KEY"

Returns {"balance": "10.000000", "currency": "USDC", "network": "base"}.

Proactive monitoring: If balance drops below $1.00, warn the user and offer a funding link.

Funding the Wallet

When the user needs to add more funds, or when balance is low:

curl -s -X POST https://cloud.payrail402.com/api/v1/fund \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $PAYRAIL402_API_KEY" \
  -d '{"amountUsd": 25}'

Returns {"fundingUrl": "https://checkout.stripe.com/...", "currentBalance": "2.500000"}.

Send the fundingUrl to the user in the chat. They click it, pay with a card, and the balance updates within seconds.

Making Paid API Calls (x402 Proxy)

When you need to call an API that requires x402 payment, route through the Payrail402 proxy:

curl -s -X POST https://cloud.payrail402.com/api/v1/proxy/pay \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $PAYRAIL402_API_KEY" \
  -d '{
    "url": "https://api.example.com/paid-endpoint",
    "method": "GET",
    "headers": {}
  }'

The proxy handles the x402 payment negotiation automatically. If the target API returns HTTP 402, the proxy pays from your wallet and retries.

Viewing Transactions

To see recent spending:

curl -s "https://cloud.payrail402.com/api/v1/transactions?limit=10" \
  -H "X-API-Key: $PAYRAIL402_API_KEY"

Quick Reference

Action Endpoint Auth
Provision wallet POST /api/v1/provision None (public)
Check balance GET /api/v1/wallets/balance X-API-Key
Get funding link POST /api/v1/fund X-API-Key
Pay for API call POST /api/v1/proxy/pay X-API-Key
List transactions GET /api/v1/transactions X-API-Key

Important Notes

  • All balances are in USDC (1 USDC = $1 USD).
  • Funding is via Stripe — accepts all major credit/debit cards.
  • The wallet is on the Base network (L2), so transaction fees are minimal.
  • Budget limits can be set via the dashboard to cap spending per period.
  • Never expose the API key in messages to the user. Store it only in config files.

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

x402usdccrypto-walletapi-paymentagent-automationbase-network

同类 Skill