AI agents increasingly need to transact in digital value — paying for compute, purchasing API credits, settling with other agents, or receiving micropayments from users. XPayLabs provides the infrastructure for agents to hold and transfer stablecoins autonomously, without a third-party custodian.Documentation Index
Fetch the complete documentation index at: https://docs.xpaylabs.com/llms.txt
Use this file to discover all available pages before exploring further.
Why Crypto for AI Agents?
| Challenge | XPayLabs Solution |
|---|---|
| Agents need programmable money | REST API for createCollection / createPayout — agents call endpoints directly |
| No human in the loop for approvals | Automated signing with environment-stored secrets |
| Cross-border agent-to-agent payments | Stablecoins on TRON, EVM, and SUI settle in seconds |
| Microtransactions | Zero gateway fees — only blockchain gas costs (0.50) |
| Self-custody required | Non-custodial — keys stay in your Docker containers |
Agent Payment Flows
Incoming Payments (Agent Gets Paid)
An agent receives crypto payments by creating collection orders. This is the most common flow — users or other agents send funds to a deposit address generated by the agent.ORDER_SUCCESS webhook to release the service:
Outgoing Payments (Agent Pays Out)
An agent initiates payouts to external addresses — paying for compute, staking, or settling with other agents:Agent-to-Agent Payments
Two autonomous agents can transact directly:Autonomous Agent Architecture
Key Design Considerations
Secret Management
The merchant token and API secret must be accessible to the agent at runtime without hardcoding:Idempotency
Agents may retry failed requests. Use theorderId field as an idempotency key — the same orderId on a createCollection or createPayout call returns the existing order instead of creating a duplicate.
Webhook Reliability
Agents should use the polling fallback (getOrderStatus) if webhooks are missed. Poll every 3 seconds until SUCCESS, EXPIRED, or FAILED:
Balance Management
Before creating payouts, check the gateway’s hot wallet balance:Use Cases
| Use Case | Flow | Example |
|---|---|---|
| API access pay-per-call | Agent creates collection → user pays → webhook unlocks endpoint | LLM inference API |
| Compute marketplace | Agent A pays Agent B for GPU time via payout | Distributed ML training |
| Autonomous affiliate | Affiliate agent receives collection webhook, splits payout to referrer | Referral program |
| Agent-to-agent settlement | Periodic batch payouts between agent wallets | Cross-agent accounting |
| Micropayment streaming | Frequent small collections (ticketed) | Real-time data feeds |
Getting Started
- Deploy XPayLabs via Docker Compose
- Install the Node.js SDK or call the REST API directly
- Configure your agent’s environment with the merchant token and API secret
- Create a webhook endpoint for
ORDER_SUCCESSevents - Start creating collection and payout orders programmatically

