USDC Payments API — Agent-to-Agent

Pay and get paid in USDC.
No banks. No friction.

Purple Flea unifies USDC payments across six chains behind a single API key. Deposit once, spend anywhere. Pay other agents, withdraw referral commissions, and convert any token to USDC automatically — all programmatically, no web UI required.

Gas is abstracted: For USDC transfers, Purple Flea covers gas costs and deducts a small fee from the transfer amount. Your agent never needs to hold native tokens (ETH, MATIC, SOL, TRX) to send payments. One API key, six chains, zero gas management.
Ethereum
Base
Polygon
Arbitrum
Tron
Solana

Six chains. One API key.

Every Purple Flea account has a USDC deposit address on each supported chain. Deposits on any chain are credited to your unified account balance. Transfers out can be sent on any chain your recipient prefers.

Chain Chain ID / Network USDC Contract Avg finality Gas fee (abstracted)
Ethereum chainId: 1 0xA0b86991c6218... ~12s 0.15% min $0.10
Base chainId: 8453 0x833589fCD6eDb... ~2s 0.05% min $0.01
Polygon chainId: 137 0x3c499c542cEF5... ~2s 0.05% min $0.01
Arbitrum chainId: 42161 0xaf88d065e77c8... ~1s 0.05% min $0.01
Tron mainnet TEkxiTehnzSmse... ~3s 0.05% min $0.01
Solana mainnet-beta EPjFWdd5AufqSS... ~0.4s 0.05% min $0.01
Recommended chain for agent payments: Base or Arbitrum offer the best combination of speed, low fees, and EVM compatibility. Solana is fastest for high-frequency micropayments. Tron USDC (TRC-20) is widely used in Asia-focused agent networks.

Getting a deposit address

Every Purple Flea product API exposes a /balance endpoint that returns your current USDC balance and a unique deposit address for each chain. Send USDC to any of these addresses and it is credited to your account automatically within one confirmation.

1
Fetch your deposit addresses
Call GET /v1/balance on any product API. The response includes a deposit_addresses map with one address per chain.
2
Send USDC to the chain address of your choice
Use your wallet, exchange, or another agent's POST /v1/transfer call to send native USDC to the address. Native USDC only — not bridged variants.
3
Balance credited automatically
After one on-chain confirmation, the deposit is credited to your Purple Flea account. Available for trading, betting, domain purchases, or transfers immediately.

Get deposit addresses

curl https://api.purpleflea.com/v1/balance \ -H "Authorization: Bearer sk_live_..." # Response: { "usdc_balance": 247.50, "pending_deposits": 0.00, "deposit_addresses": { "ethereum": "0xAbC1234...your_eth_address", "base": "0xAbC1234...your_base_address", "polygon": "0xAbC1234...your_polygon_address", "arbitrum": "0xAbC1234...your_arbitrum_address", "tron": "TYourTronAddress...", "solana": "YourSolanaAddress..." }, "last_deposit_at": "2025-11-14T08:30:00Z" }

The same /balance endpoint works across all product APIs using the same API key: casino, trading, wallet, and domains share a unified balance. You do not need to fund each product separately.

GEThttps://api.purpleflea.com/v1/balanceUnified balance + deposit addresses
GEThttps://casino.purpleflea.com/api/v1/wallet/balanceCasino balance view
GEThttps://trading.purpleflea.com/v1/account/balanceTrading balance view
GEThttps://wallet.purpleflea.com/v1/balance/{chain}/{address}On-chain wallet balance

Sending USDC to another agent

Use POST /v1/transfer to send USDC from your Purple Flea account to any address on any supported chain. Specify the chain, destination address, and amount. Purple Flea handles the on-chain transaction and returns a receipt with the transaction hash.

POST/v1/transferSend USDC to any address on any supported chain
POST/v1/transfer/batchSend to multiple addresses in a single API call
GET/v1/transfersList transfer history with status and tx hashes
GET/v1/transfers/{id}Get a single transfer with full receipt

Pay another agent

curl -X POST https://api.purpleflea.com/v1/transfer \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "chain": "base", "to_address": "0xRecipientAgentAddress...", "amount": 25.00, "memo": "payment_for_data_feed_nov14" }' # Response: { "transfer_id": "txfr_01HXYZ_PAY_001", "status": "submitted", "chain": "base", "to_address": "0xRecipientAgentAddress...", "amount_sent": 25.00, "fee_deducted": 0.013, "amount_received": 24.987, "tx_hash": "0x4a8f3b2c...", "block_explorer_url": "https://basescan.org/tx/0x4a8f3b2c...", "estimated_confirmation_seconds": 2, "memo": "payment_for_data_feed_nov14", "created_at": "2025-11-14T20:00:00Z" }

Poll for confirmation

curl https://api.purpleflea.com/v1/transfers/txfr_01HXYZ_PAY_001 \ -H "Authorization: Bearer sk_live_..." # Response (confirmed): { "transfer_id": "txfr_01HXYZ_PAY_001", "status": "confirmed", "confirmations": 12, "confirmed_at": "2025-11-14T20:00:03Z", "tx_hash": "0x4a8f3b2c...", "block_number": 19847891 }
Or use webhooks: Instead of polling for transfer confirmation, register a webhook for the transfer.confirmed event on /webhook-api. Your agent will be notified within milliseconds of on-chain confirmation.

Pay multiple agents in one call

POST /v1/transfer/batch accepts an array of up to 100 recipients. All transfers in a batch are processed atomically on-chain where possible (e.g., single Solana transaction, multicall on EVM chains). The fee applies per transfer but batching reduces processing overhead.

batch_payment.sh
curl -X POST https://api.purpleflea.com/v1/transfer/batch \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "chain": "base", "transfers": [ { "to_address": "0xAgent_Alpha...", "amount": 10.00, "memo": "data_oracle_fee" }, { "to_address": "0xAgent_Beta...", "amount": 5.50, "memo": "compute_service_fee" }, { "to_address": "TronAgentAddress...", "amount": 8.25, "memo": "asia_market_feed", "chain": "tron" } ] }' # Response: { "batch_id": "batch_01HXYZ_001", "total_amount": 23.75, "total_fees": 0.037, "transfer_count": 3, "status": "processing", "transfers": [ { "transfer_id": "txfr_01A", "to_address": "0xAgent_Alpha...", "amount": 10.00, "status": "submitted", "tx_hash": "0xabc..." }, { "transfer_id": "txfr_01B", "to_address": "0xAgent_Beta...", "amount": 5.50, "status": "submitted", "tx_hash": "0xdef..." }, { "transfer_id": "txfr_01C", "to_address": "TronAgentAddress...", "amount": 8.25, "status": "submitted", "tx_hash": "tron_tx_abc..." } ] }

Swap any token to USDC before paying

If your agent holds ETH, SOL, BTC, or any other token instead of USDC, you can set "auto_convert": true on any transfer. Purple Flea will swap the required amount of your native token to USDC at the best available rate via DEX routing, then execute the transfer. The swap fee and transfer fee are both deducted from the proceeds.

curl -X POST https://api.purpleflea.com/v1/transfer \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "chain": "ethereum", "to_address": "0xRecipientAddress...", "amount": 50.00, "auto_convert": true, "from_token": "ETH" }' # What happens behind the scenes: # 1. Purple Flea checks your ETH balance (e.g., 0.05 ETH @ $3000 = $150) # 2. Calculates ETH needed for $50 USDC + swap fee + transfer fee # 3. Swaps exactly that amount via Uniswap v3 (best rate) # 4. Sends $50 USDC (minus transfer fee) to recipient # 5. Returns combined receipt with swap_tx_hash + transfer_tx_hash { "transfer_id": "txfr_01HXYZ_CONV", "status": "confirmed", "amount_sent": 50.00, "fee_deducted": 0.525, "amount_received": 49.475, "from_token": "ETH", "eth_spent": 0.01725, "swap_rate": 2898.55, "swap_tx_hash": "0x9f1a2b...", "transfer_tx_hash": "0x7c3d4e..." }
Slippage note: Auto-conversion uses a default 0.5% slippage tolerance. For large amounts (>$1,000 equivalent), set "max_slippage_pct": 1.0 to avoid failed conversions on thin markets. For micropayments, the default is fine.

Withdrawing your referral earnings

Every time a referred agent generates a fee, your commission is credited to your Purple Flea account instantly. You can check your accumulated balance and withdraw to any address at any time. There is no minimum withdrawal, no lock-up period, and no expiry on earned commissions.

GET/v1/referralsSummary: total earned, pending, by source API
GET/v1/referrals/historyPer-event commission history with timestamps
POST/v1/referrals/withdrawWithdraw commissions to external address

Check referral earnings

curl https://api.purpleflea.com/v1/referrals \ -H "Authorization: Bearer sk_live_..." { "total_earned_usd": 387.25, "available_to_withdraw_usd": 312.50, "pending_usd": 74.75, "referred_agents": 14, "breakdown": { "casino": { "earned": 42.10, "agents": 3 }, "trading": { "earned": 298.40, "agents": 8 }, "wallet": { "earned": 31.75, "agents": 5 }, "domains": { "earned": 15.00, "agents": 3 } }, "last_earned_at": "2025-11-14T18:00:44Z" }

Withdraw commissions

curl -X POST https://api.purpleflea.com/v1/referrals/withdraw \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "chain": "base", "to_address": "0xMyWalletAddress...", "amount": 312.50 }' # Response: { "withdrawal_id": "wdr_01HXYZ_REF_001", "status": "submitted", "amount": 312.50, "fee_deducted": 0.16, "amount_received": 312.34, "chain": "base", "to_address": "0xMyWalletAddress...", "tx_hash": "0x2b9f4d1a...", "block_explorer_url": "https://basescan.org/tx/0x2b9f4d1a...", "estimated_confirmation_seconds": 2 }
Automated withdrawal pattern: Combine with webhooks. Subscribe to referral.earned events (see /webhook-api). When the event payload shows cumulative_earned_usd exceeding your threshold, call POST /v1/referrals/withdraw automatically. No manual monitoring required.

Complete payment flows

Python — Pay another agent and verify receipt

pay_agent.py
import requests import time API_KEY = "sk_live_your_api_key_here" BASE_URL = "https://api.purpleflea.com" HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"} def pay_agent(to_address: str, amount_usd: float, chain: str = "base", memo: str = "") -> dict: """Send USDC to another agent and wait for confirmation.""" # 1. Check we have enough balance balance_resp = requests.get(f"{BASE_URL}/v1/balance", headers=HEADERS) balance_resp.raise_for_status() available = balance_resp.json()["usdc_balance"] if available < amount_usd: raise ValueError(f"Insufficient balance: have ${available:.2f}, need ${amount_usd:.2f}") # 2. Submit transfer transfer_resp = requests.post( f"{BASE_URL}/v1/transfer", headers=HEADERS, json={ "chain": chain, "to_address": to_address, "amount": amount_usd, "memo": memo, } ) transfer_resp.raise_for_status() transfer = transfer_resp.json() transfer_id = transfer["transfer_id"] print(f"Submitted: {transfer_id}, tx: {transfer['tx_hash']}") # 3. Poll for confirmation (or use webhooks instead) for attempt in range(30): time.sleep(2) status_resp = requests.get( f"{BASE_URL}/v1/transfers/{transfer_id}", headers=HEADERS ) status = status_resp.json() if status["status"] == "confirmed": print(f"Confirmed in block {status['block_number']}") print(f"Explorer: {transfer['block_explorer_url']}") return status elif status["status"] == "failed": raise RuntimeError(f"Transfer failed: {status.get('error')}") raise TimeoutError("Transfer not confirmed within 60 seconds") def withdraw_referral_earnings(to_address: str, chain: str = "base") -> dict: """Withdraw all available referral commissions.""" # Check balance resp = requests.get(f"{BASE_URL}/v1/referrals", headers=HEADERS) resp.raise_for_status() data = resp.json() available = data["available_to_withdraw_usd"] if available < 1.0: print(f"Only ${available:.2f} available, skipping") return {} # Withdraw withdraw_resp = requests.post( f"{BASE_URL}/v1/referrals/withdraw", headers=HEADERS, json={"chain": chain, "to_address": to_address, "amount": available} ) withdraw_resp.raise_for_status() result = withdraw_resp.json() print(f"Withdrew ${result['amount']:.2f} → {result['tx_hash']}") return result # Example usage if __name__ == "__main__": receipt = pay_agent( to_address="0xOtherAgent123...", amount_usd=15.00, chain="base", memo="november_compute_fees" ) print(f"Payment complete: ${receipt['amount_sent']:.2f} USDC sent") withdraw_referral_earnings("0xMyWallet...", chain="base")

Node.js — Batch payment to multiple agents

batchPayments.js
import fetch from 'node-fetch'; const API_KEY = 'sk_live_your_api_key_here'; const BASE_URL = 'https://api.purpleflea.com'; const headers = { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }; /** * Pay multiple agents at once. Splits recipients by chain for atomic batching. * @param {Array<{address: string, amount: number, chain: string, memo?: string}>} payments */ async function batchPayAgents(payments) { // Group by chain for efficient batching const byChain = payments.reduce((acc, p) => { (acc[p.chain] ??= []).push({ to_address: p.address, amount: p.amount, memo: p.memo }); return acc; }, {}); const results = []; for (const [chain, transfers] of Object.entries(byChain)) { console.log(`Sending ${transfers.length} payments on ${chain}...`); const resp = await fetch(`${BASE_URL}/v1/transfer/batch`, { method: 'POST', headers, body: JSON.stringify({ chain, transfers }) }); if (!resp.ok) { const err = await resp.json(); throw new Error(`Batch failed on ${chain}: ${JSON.stringify(err)}`); } const batch = await resp.json(); console.log(`Batch ${batch.batch_id}: ${batch.transfer_count} transfers, total $${batch.total_amount}`); results.push(batch); } return results; } async function checkBalance() { const resp = await fetch(`${BASE_URL}/v1/balance`, { headers }); const data = await resp.json(); return data.usdc_balance; } // Example: pay a team of specialized agents their monthly fees async function payAgentTeam() { const balance = await checkBalance(); console.log(`Current balance: $${balance.toFixed(2)} USDC`); const teamPayments = [ { address: '0xDataOracle_Alpha...', amount: 20.00, chain: 'base', memo: 'data_oracle_nov' }, { address: '0xSignalGen_Beta...', amount: 15.00, chain: 'base', memo: 'signal_gen_nov' }, { address: '0xRiskMgr_Gamma...', amount: 12.50, chain: 'arbitrum', memo: 'risk_mgr_nov' }, { address: 'SolanaAgentPubkey...', amount: 8.00, chain: 'solana', memo: 'solana_agent_nov' }, { address: 'TronAgentAddr...', amount: 5.00, chain: 'tron', memo: 'tron_agent_nov' }, ]; const totalNeeded = teamPayments.reduce((sum, p) => sum + p.amount, 0); if (balance < totalNeeded) { throw new Error(`Insufficient balance: have $${balance}, need $${totalNeeded}`); } const results = await batchPayAgents(teamPayments); const totalSent = results.reduce((sum, b) => sum + b.total_amount, 0); const totalFees = results.reduce((sum, b) => sum + b.total_fees, 0); console.log(`Done. Sent: $${totalSent.toFixed(2)}, Fees: $${totalFees.toFixed(4)}`); return results; } payAgentTeam().catch(console.error);

How gas-free USDC transfers work

Normally, sending USDC on-chain requires the sender to hold native tokens for gas: ETH on Ethereum/Base/Arbitrum, MATIC on Polygon, TRX on Tron, SOL on Solana. This is a significant friction point for agents that operate exclusively in USDC.

Purple Flea solves this with a gas relay model. When you call POST /v1/transfer, Purple Flea submits the transaction from its own gas wallet, paying the network fee on your behalf. The cost is recouped by deducting a small percentage from the transfer amount.

🏭
No native token required
Your agent only needs to hold USDC. Never worry about ETH, MATIC, SOL, or TRX balance management.
💰
Fee deducted from amount
The fee (0.05%–0.15% depending on chain) is taken from the transfer amount, not billed separately. Predictable economics.
Same speed as native transfers
Purple Flea uses pre-funded gas wallets per chain. No waiting for gas to be acquired. Transactions submit within 200ms of your API call.
📋
Receipt with tx hash
Every transfer returns a transaction hash and block explorer link. Payments are fully verifiable on-chain. Receipts are permanent.
🔄
Cross-chain in one call
Specify any destination chain per transfer. If your recipient is on Tron and you are funding from Base, Purple Flea handles the routing.
🔒
No custody risk
Transfers are processed in <10 seconds. Purple Flea does not hold your funds between API call and settlement — the gas relay model does not require pre-funding your balance with Purple Flea.