Get the FREE Ultimate OpenClaw Setup Guide →
p

Agent Wallet For x402

Verified

@pandagg110

npx machina-cli add skill @pandagg110/agent-wallet-x402 --openclaw
Files (1)
SKILL.md
3.5 KB

SynapseAI Wallet

Use SynapseAI Wallet to give your AI agent a managed USDC wallet with policy-enforced spending.

Base URL

https://api.synapseai.pro/functions/v1

All requests require headers:

Content-Type: application/json
Authorization: Bearer <YOUR_ANON_KEY>

Flow

1. Register   → POST /register-agent      → get agent_id + token
2. Bind       → Owner opens wallet.synapseai.pro/bind?token=xxx
3. Wait       → Poll /query-balance until 200
4. Use wallet → /query-balance, /query-policy, /request-payment

Commands

Register agent

POST /register-agent
{
  "agent_name": "MyBot",
  "description": "Research assistant that purchases API credits",
  "capabilities": ["api_purchase", "subscription"]
}

Response:

{
  "agent_id": "agt_abc123",
  "temporary_wallet_id": "wal_xyz789",
  "status": "PENDING_USER_BIND",
  "registration_token": "reg_def456abcdef01"
}

After registration, tell the owner to open:

https://wallet.synapseai.pro/bind?token=<registration_token>

Check balance

GET /query-balance?agent_id=<agent_id>

Response:

{
  "agent_id": "agt_abc123",
  "currency": "USDC",
  "available_balance": 100.0,
  "today_spent": 12.5
}

Check policy

GET /query-policy?agent_id=<agent_id>

Response:

{
  "agent_id": "agt_abc123",
  "policy": {
    "daily_limit": 100,
    "tx_limit": 25,
    "approval_threshold": 10,
    "merchant_whitelist": ["openai_api", "anthropic_api"],
    "blocked_actions": ["withdraw", "transfer", "swap"]
  }
}

Make payment

POST /request-payment
{
  "agent_id": "agt_abc123",
  "merchant": "openai_api",
  "amount": 5.0,
  "currency": "USDC",
  "purpose": "GPT-4 API credits for task #42",
  "metadata": {"task_id": "42"}
}

Three possible outcomes:

  • "status": "ALLOW" — payment executed, tx_hash returned
  • "status": "REQUIRE_APPROVAL" — on hold, owner will be notified
  • "status": "REJECT" — denied, check reason field

Send webhook

POST /receive-webhook
{
  "source": "stripe",
  "event": "payment_confirmed",
  "payload": {}
}

Policy rules

  • tx_limit — max amount per single payment
  • daily_limit — max total spending per day
  • approval_threshold — payments >= this need owner approval
  • merchant_whitelist — only listed merchants are allowed
  • blocked_actions — forbidden purpose keywords

Error handling

All errors return {"error": "..."} with appropriate HTTP status:

CodeMeaning
400Bad request — missing or invalid fields
404Agent or wallet not found
405Wrong HTTP method
500Server error

Notes

  • Always check /query-policy before making a payment to know your limits.
  • Always check /query-balance to ensure sufficient funds.
  • Use clear purpose strings — the owner sees these in their dashboard.
  • If REQUIRE_APPROVAL is returned, don't block — continue other tasks and retry later.
  • Never guess or fabricate tx_hash values — they come from the server only.
  • The wallet resets today_spent at midnight UTC daily.

Source

git clone https://clawhub.ai/pandagg110/agent-wallet-x402View on GitHub

Overview

SynapseAI Wallet provides a managed USDC wallet for an AI agent with policy-enforced spending. It supports registering an agent, funding, setting spending policies, and making payments via API, all with clear outcomes and owner oversight.

How This Skill Works

Use the base URL https://api.synapseai.pro/functions/v1 with JSON headers. Flow: register the agent to obtain agent_id and token, have the owner bind the wallet at wallet.synapseai.pro/bind?token=xxx, then poll /query-balance until ready, and finally interact with /query-balance, /query-policy, and /request-payment to manage funds and payments.

When to Use It

  • Onboarding a new AI agent and funding its wallet
  • Enforcing daily spending and per-transaction limits
  • Paying approved merchants (e.g., OpenAI API) via the agent
  • Requiring owner approval for high-value payments
  • Auditing wallet activity with balance and policy checks

Quick Start

  1. Step 1: Register the agent via POST /register-agent with agent_name, description, and capabilities
  2. Step 2: Have the owner bind the wallet by opening https://wallet.synapseai.pro/bind?token=<registration_token>
  3. Step 3: Check /query-balance and /query-policy, then issue payments with /request-payment

Best Practices

  • Always check /query-balance before making payments to ensure funds are available
  • Review /query-policy before any payment to respect limits and approvals
  • Use clear purpose strings and include metadata for traceability
  • Ensure payments respect merchant_whitelist and blocked_actions
  • Handle all three outcome statuses (ALLOW, REQUIRE_APPROVAL, REJECT) with appropriate retries or alternatives

Example Use Cases

  • A research bot purchases GPT-4 API credits within its daily and per-transaction limits
  • A data-collection agent subscribes to a paid API service under the configured policy
  • A monitoring AI pays for cloud API usage to a whitelisted merchant
  • An analytics bot renews a SaaS API subscription while requiring approval for large amounts
  • An internal tooling agent pays only to whitelisted merchants and avoids restricted actions

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers