Wallet API — Agent Payments

AI agents paying
AI agents.

The future of autonomous commerce is machines transacting with machines. Purple Flea's Wallet API enables any agent to send USDC to any other agent — with no humans in the loop, no manual approvals, no minimum transfer above $0.01.

$0.01
Minimum transfer
<3s
Settlement time on Base
8+
Supported chains
0%
Purple Flea transfer fee

Why agents need to transact with each other

In the current generation of AI systems, agents consume APIs, run tools, and produce outputs — but they do not pay for services rendered by other agents. Everything is centrally controlled by humans who manage billing. This architecture breaks down as agents become more autonomous and multi-agent systems grow more complex.

Consider: an orchestrator agent delegates a research task to a specialist agent. The specialist agent charges $0.10 per query. Today, this billing is handled out-of-band by humans. In the emerging agentic economy, the orchestrator pays the specialist directly — no human needed, no invoice, no net-30 terms.

The old model

Humans handle all billing. Agent A requests work. Agent B does work. Human approves invoice. Human pays. Latency: days. Minimum viable amount: dollars. Requires trust between legal entities.

The new model

Agent A requests work and attaches a signed payment. Agent B verifies payment and executes. Settlement: seconds. Minimum viable amount: one cent. Trust enforced by cryptography.

How an A2A payment flows

Every agent on Purple Flea has a wallet address. Sending a payment is a single API call. The receiving agent can verify the payment was received before executing work. Purple Flea routes through Base or Polygon for low gas costs.

Standard payment flow — USDC on Base
Agent A (Orchestrator) ──────> wallet.purpleflea.com ──────> Agent B (Sub-Agent)
1. Agent A calls GET /v1/balance on Agent B's registered address to confirm it exists
2. Agent A calls POST /v1/wallet/send — specifying amount, currency (USDC), and Agent B's address
3. Purple Flea validates the request, signs and broadcasts the transaction on-chain
4. Base (or Polygon) confirms the transaction in ~2 seconds
5. Agent B calls its own GET /v1/balance — sees the received USDC — proceeds with task
POST /v1/wallet/send body: { to: "0xAgentB...", amount: "0.50", currency: "USDC", chain: "base" } response: { tx_hash: "0x...", status: "confirmed", fee_usd: "0.0003" }

Gas optimization

Use Base or Polygon for micropayments. A $0.01 USDC transfer on Base costs approximately $0.0002–$0.0005 in gas — making per-task micropayments economically viable. Ethereum mainnet costs ~$0.50–$3.00 for the same transfer and should only be used for larger settlements.

How to set up A2A payments in four steps

1

Register both agents on the Wallet API

Each agent needs its own API key and wallet address. Registration is a single POST call — no KYC, no email verification, returns an API key and a set of wallet addresses immediately.

curl -X POST https://wallet.purpleflea.com/v1/auth/register \ -H "Content-Type: application/json" \ -d '{}' # Response (save the api_key — shown only once): { "api_key": "sk_live_abc123...", "referral_code": "REF_xyz" }
2

Create an HD wallet and note the address

After registration, create a wallet on your preferred chain. The mnemonic phrase is shown exactly once — store it securely. The wallet address is permanent and can be shared with other agents as your payment destination.

curl -X POST https://wallet.purpleflea.com/v1/wallet/create \ -H "Authorization: Bearer sk_live_abc123..." \ -H "Content-Type: application/json" \ -d '{"chain": "base", "label": "orchestrator-main"}' # Response: { "wallet_id": "wal_...", "address": "0x1a2b3c4d...", "chain": "base", "label": "orchestrator-main" // mnemonic shown here ONCE if new HD wallet }
3

Exchange wallet addresses between agents

The paying agent needs the receiving agent's wallet address. Retrieve it via the /v1/balance endpoint — or share it during agent initialization through a system prompt or configuration. Addresses are deterministic and permanent.

# Agent A queries Agent B's balance endpoint to discover its address # (Agent B exposes its address at its own /v1/balance endpoint) curl https://wallet.purpleflea.com/v1/balance/base/0xAgentB... \ -H "Authorization: Bearer sk_live_abc123..." # Response: { "address": "0xAgentB...", "chain": "base", "balances": { "USDC": "12.50", "ETH": "0.004" }, "usd_total": "25.10" }
4

Send the payment

Agent A calls the send endpoint. The transaction is broadcast immediately. Agent B can poll its balance or use a webhook to detect receipt and proceed.

curl -X POST https://wallet.purpleflea.com/v1/wallet/send \ -H "Authorization: Bearer sk_live_abc123..." \ -H "Content-Type: application/json" \ -d '{ "to": "0xAgentB...", "amount": "0.50", "currency": "USDC", "chain": "base", "memo": "task-id:research-7f3a" }' # Response: { "tx_hash": "0xdeadbeef...", "status": "confirmed", "from": "0xAgentA...", "to": "0xAgentB...", "amount": "0.50", "currency": "USDC", "chain": "base", "fee_usd": "0.0004", "block_number": 14820193 }

Payment endpoints

All endpoints use Bearer token auth: Authorization: Bearer {api_key}. Base URL: https://wallet.purpleflea.com

POST /v1/wallet/send Send USDC or tokens to any address
GET /v1/balance/{chain}/{address} Get token balances for any address (no auth needed)
GET /v1/wallet/transactions List sent and received transactions
GET /v1/wallet/transaction/{tx_hash} Get status of a specific transaction
POST /v1/wallet/create Create a new HD wallet on a specific chain
POST /v1/auth/register Register a new agent, receive API key

Send endpoint — full request schema

POST https://wallet.purpleflea.com/v1/wallet/send Headers: Authorization: Bearer {api_key} Content-Type: application/json Body: { "to": string, // recipient wallet address (required) "amount": string, // decimal string, e.g. "0.50" (required) "currency": string, // "USDC" | "USDT" | "ETH" | "MATIC" | ... (required) "chain": string, // "base" | "polygon" | "ethereum" | "arbitrum" | "solana" | ... "memo": string, // optional reference string — stored on-chain in tx data "speed": string // "normal" | "fast" | "instant" — affects gas bid } Response: { "tx_hash": string, // on-chain transaction hash "status": string, // "pending" | "confirmed" | "failed" "from": string, // your wallet address "to": string, // recipient address "amount": string, // amount transferred "currency": string, "chain": string, "fee_usd": string, // approximate gas cost in USD "block_number": number }

Sub-cent economics: what $0.01 enables

The minimum transfer on Purple Flea's Wallet API is $0.01 USDC. On Base, gas fees are typically $0.0002–$0.0005 — meaning a $0.01 transfer is economically rational. This enables payment models that were previously impossible.

Payment model Amount per event Chain recommendation Gas as % of payment
Pay-per-token (LLM inference) $0.001–$0.01 Base 3–50%
Pay-per-API-call $0.01–$0.10 Base or Polygon 0.3–3%
Pay-per-task-completed $0.10–$5.00 Base or Arbitrum <0.3%
Pay-per-research-report $1.00–$20.00 Any chain Negligible
Monthly revenue sharing $50–$5,000 Ethereum or Base Negligible

Batching for sub-cent workloads

For truly granular payments (e.g., $0.0001 per token), batch payments every N events or every T seconds. Accumulate micro-debts in memory, settle in a single transaction when the total reaches $0.01 or above. This keeps gas costs well below 5% of payment value on Base.

Where A2A payments are used today

🎯

Orchestrator pays sub-agents for completed tasks

An orchestrator agent breaks down a complex job and dispatches sub-tasks to specialist agents. Each sub-agent receives payment upon verified task completion — enforcing accountability and creating a market for specialized agent capabilities.

🔌

Agents pay for specialized API access

A data-gathering agent accesses a proprietary financial data agent that charges $0.05 per query. Rather than a human managing a subscription, the consuming agent sends USDC per call. No vendor relationship required — just an address.

💰

Royalty payments between agent systems

A content-generating agent uses a fine-tuned model created by another agent system. The model creator receives a $0.001 royalty per generation — automatically, via a payment hook embedded in the generation workflow.

🔗

Revenue sharing in multi-agent pipelines

A pipeline of 6 agents each adds value to a final output sold to a user for $10. Revenue is automatically split — $3 to the orchestrator, $1 to each specialist agent — based on pre-agreed percentages encoded in the payment logic.

📊

Agent-to-agent data marketplaces

Agents with access to proprietary data (real-time prices, sensor readings, web scrapes) sell that data to other agents on demand. No central marketplace needed — just wallets and agreed-upon pricing embedded in system prompts.

🏆

Bounty and incentive systems

An orchestrator posts a bounty: "First agent to return a verified answer to X gets $0.50." Multiple agents compete. The orchestrator pays on receipt of the verified solution. Autonomous competition with cryptographic settlement.

Python orchestrator paying a sub-agent

A complete example: an orchestrator agent that delegates a research task to a specialist sub-agent, verifies completion, and pays the agreed amount. Uses only the requests library — no SDK required.

import requests import time # --- Configuration --- ORCHESTRATOR_API_KEY = "sk_live_orchestrator_abc..." SUBAGENT_WALLET_ADDRESS = "0xSubAgent1234..." # obtained from sub-agent's /v1/balance WALLET_API = "https://wallet.purpleflea.com" PAYMENT_AMOUNT = "0.50" # $0.50 USDC per completed research task CHAIN = "base" # cheap gas for micropayments def verify_subagent_exists(address: str) -> bool: """Confirm the sub-agent's wallet address is live before sending payment.""" resp = requests.get( f"{WALLET_API}/v1/balance/{CHAIN}/{address}", headers={"Authorization": f"Bearer {ORCHESTRATOR_API_KEY}"}, timeout=10 ) return resp.status_code == 200 def dispatch_task(subagent_url: str, task: dict) -> dict: """Send a task to the sub-agent and wait for completion.""" resp = requests.post( f"{subagent_url}/tasks", json=task, timeout=30 ) resp.raise_for_status() return resp.json() def pay_subagent(to_address: str, amount: str, task_id: str) -> dict: """Send USDC payment to sub-agent after task completion.""" resp = requests.post( f"{WALLET_API}/v1/wallet/send", headers={ "Authorization": f"Bearer {ORCHESTRATOR_API_KEY}", "Content-Type": "application/json" }, json={ "to": to_address, "amount": amount, "currency": "USDC", "chain": CHAIN, "memo": f"task-id:{task_id}" # on-chain reference }, timeout=15 ) resp.raise_for_status() return resp.json() def wait_for_confirmation(tx_hash: str, max_wait: int = 30) -> bool: """Poll until transaction is confirmed or timeout.""" for _ in range(max_wait): resp = requests.get( f"{WALLET_API}/v1/wallet/transaction/{tx_hash}", headers={"Authorization": f"Bearer {ORCHESTRATOR_API_KEY}"} ) data = resp.json() if data.get("status") == "confirmed": return True if data.get("status") == "failed": return False time.sleep(1) return False # --- Main orchestration flow --- def run_paid_task(task: dict) -> dict: # 1. Verify sub-agent is reachable if not verify_subagent_exists(SUBAGENT_WALLET_ADDRESS): raise ValueError("Sub-agent wallet address not found — verify address") # 2. Dispatch task to sub-agent print(f"Dispatching task: {task['type']}") result = dispatch_task("https://my-subagent.example.com", task) task_id = result["task_id"] print(f"Task completed: {task_id}") # 3. Pay sub-agent for completed work payment = pay_subagent(SUBAGENT_WALLET_ADDRESS, PAYMENT_AMOUNT, task_id) tx_hash = payment["tx_hash"] print(f"Payment sent: {tx_hash}") # 4. Wait for on-chain confirmation confirmed = wait_for_confirmation(tx_hash) if confirmed: print(f"Payment confirmed on {CHAIN}. Cost: ${payment['fee_usd']} gas") else: print("Warning: transaction not yet confirmed — check manually") return { "result": result, "payment_tx": tx_hash, "payment_confirmed": confirmed } # Example usage if __name__ == "__main__": output = run_paid_task({ "type": "market_research", "query": "Top 5 DeFi protocols by TVL this week", "format": "json" }) print(output)

Earning commissions on top of direct payments

A2A payments and the referral program are complementary revenue streams. When you register another agent on any Purple Flea service using your referral code, you earn commissions on their activity fees — independently of any direct payments you may also send or receive from them.

Two income streams from one agent relationship

Scenario: You are an orchestrator agent. You register a trading sub-agent using your referral code. That sub-agent also trades on your behalf (pays trading fees). You receive:

  • + 20% referral commission on all trading fees generated by the sub-agent — automatically, forever
  • + Direct payments from the sub-agent for any other work it performs on your behalf

Register a sub-agent with your referral code

import requests def register_subagent_with_referral(my_referral_code: str) -> dict: """ Register a new sub-agent on the Wallet API using our referral code. We earn 10% of this agent's swap fees forever. """ resp = requests.post( "https://wallet.purpleflea.com/v1/auth/register", json={"referral_code": my_referral_code}, timeout=10 ) resp.raise_for_status() data = resp.json() # data["api_key"] — give this to the sub-agent # data["referral_code"] — the sub-agent's own code for further referrals return data # Embed in sub-agent spawning logic: subagent_creds = register_subagent_with_referral("REF_mycode_xyz") print("Sub-agent API key:", subagent_creds["api_key"]) # Now configure the sub-agent with this API key # You earn 10% of every swap it makes, indefinitely

Check your referral earnings across all Purple Flea services at any time via the GET /v1/referrals endpoint — available on the Wallet, Casino, Trading, and Domains APIs. Earnings accumulate automatically and can be withdrawn or re-invested.

Preventing payment fraud in A2A systems

Autonomous payment systems require explicit security controls. Purple Flea's Wallet API supports several mechanisms to prevent unauthorized payments and address spoofing.

API key authentication

Every payment request must be authenticated with the sending agent's API key. Keys are never shared between agents — each agent has its own key from its own registration.

Address whitelisting

Configure a whitelist of approved destination addresses via POST /v1/wallet/whitelist. When enabled, payment requests to non-whitelisted addresses are rejected at the API layer, before any transaction is broadcast.

Per-transaction spending limits

Set a maximum single-transaction amount via POST /v1/wallet/limits. Requests above the limit are rejected. Prevents a compromised agent from draining the entire wallet in a single call.

On-chain memo field for verification

Always include a memo field with a task ID or nonce in every payment. The receiving agent can verify the memo against expected task IDs, rejecting duplicate or replayed payment claims. Memo data is stored in the transaction calldata.

Payment verification before executing work

For high-value tasks, require payment upfront and confirm the transaction hash on-chain before the sub-agent begins work. Use GET /v1/wallet/transaction/{tx_hash} to poll for confirmation status. Do not trust status: "pending" for irreversible work delivery.

Rate limiting on send endpoint

The /v1/wallet/send endpoint enforces per-minute and per-hour rate limits. This protects against runaway loops in agent code that could drain funds rapidly. Limits are configurable per API key via the wallet dashboard.

Secure payment pattern (receive-then-execute)

import requests import time WALLET_API = "https://wallet.purpleflea.com" SUBAGENT_API_KEY = "sk_live_subagent_..." MY_WALLET_ADDRESS = "0xSubAgentAddress..." def verify_payment_received(tx_hash: str, expected_amount: float, expected_sender: str, task_nonce: str) -> bool: """ Verify an incoming payment before executing irreversible work. Checks: amount, sender, memo nonce, and confirmation status. """ resp = requests.get( f"{WALLET_API}/v1/wallet/transaction/{tx_hash}", headers={"Authorization": f"Bearer {SUBAGENT_API_KEY}"}, timeout=10 ) if resp.status_code != 200: return False tx = resp.json() # Verify all conditions before proceeding checks = [ tx.get("status") == "confirmed", # on-chain confirmed float(tx.get("amount", 0)) >= expected_amount, # correct amount tx.get("from", "").lower() == expected_sender.lower(), # known sender tx.get("to", "").lower() == MY_WALLET_ADDRESS.lower(), # correct recipient task_nonce in tx.get("memo", ""), # nonce matches task ] return all(checks) # In the sub-agent's task handler: def handle_task_request(task_data: dict) -> dict: tx_hash = task_data.get("payment_tx_hash") task_id = task_data.get("task_id") # Wait up to 30 seconds for confirmation for attempt in range(30): if verify_payment_received( tx_hash=tx_hash, expected_amount=0.50, expected_sender=task_data["sender_address"], task_nonce=task_id ): # Payment verified — safe to execute irreversible work return execute_task(task_data) time.sleep(1) return {"error": "payment not confirmed within timeout"} def execute_task(task_data: dict) -> dict: # ... actual task logic return {"status": "completed", "result": "..."}