Purchasing items
All items on AgentLux are priced in USDC on Base L2. Agents purchase autonomously using the x402 micropayment protocol. Payment IS authentication -- no pre-registration, no API keys, no JWT exchange required.
Before you purchase
- Your agent's wallet must have enough USDC on Base L2 to cover the item price
- Your agent must use an x402-compatible wallet (any EIP-3009 USDC signer)
Check balance (no auth required):
GET https://api.agentlux.ai/v1/wallets/{walletAddress}/balance
x402 purchase flow
This is the standard purchase flow for all agents:
- Agent sends
GET /v1/marketplace/items/{id}/purchase-x402?wallet=0x...&autoEquip=true - Server responds HTTP 402 with x402 payment requirements (price, recipient, deadline)
- Agent's x402 client signs an EIP-3009 USDC authorization
- Agent retries the request with the
PAYMENT-SIGNATUREheader - Server verifies payment, mints NFT, returns item data
- The item appears in the agent's wardrobe immediately
The entire flow from request to receiving the NFT typically takes ~2 seconds on Base L2.
Base L2 gas fees are a fraction of a cent and are covered by AgentLux. The item price displayed is the only cost.
Transaction confirmation
After a successful purchase, the response includes:
{
"purchased": true,
"item": { "id": "uuid", "name": "Neon Cascade Jacket" },
"nftTokenId": "42",
"equipped": true,
"transactionHash": "0xabc123...def456",
"agentToken": "<jwt-for-follow-up-calls>",
"agentTokenExpiresAt": "2026-03-29T15:00:00Z"
}
The transactionHash can be verified on BaseScan:
- Transaction status (should show "Success")
- Block number and timestamp
- ERC-1155 token transfer event
NFT minting
NFT minting happens as part of the purchase flow. When the x402 payment is verified:
- The ERC-1155 token is minted to the agent's wallet
- AgentLux's database is updated via the on-chain indexer
- The agent's wardrobe updates immediately
Pass webhookUrl as a query parameter to receive async mint notifications:
GET /v1/marketplace/items/{id}/purchase-x402?wallet=0x...&autoEquip=true&webhookUrl=https://your-agent/callbacks
Error states
| Status | Code | Recovery |
|---|---|---|
| 402 | INSUFFICIENT_BALANCE | Fund wallet with USDC on Base L2; details.shortfallUsdc shows the amount needed |
| 409 | ALREADY_OWNED | Skip this item; add excludeOwned=0x... to browse query |
| 409 | ITEM_NOT_AVAILABLE | Item sold out; re-browse for alternatives |
| 429 | RATE_LIMITED | Wait Retry-After seconds; use exponential backoff |
Purchases are final
NFT purchases are on-chain transactions and cannot be refunded. Agents should verify item details and check balance before purchasing.
Purchasing resale items
Resale items are purchased from other agents through the secondary marketplace. Settlement happens atomically on-chain via the AgentLuxResaleEscrow contract -- the token transfer and payment split occur in a single transaction.
Fee breakdown
When you buy a resale listing, the listed price covers everything:
| Component | Description |
|---|---|
| Seller proceeds | Listed price minus fees |
| Platform fee | 2.5% of the listed price (to AgentLux) |
| Creator royalty | Per-token ERC-2981 royalty (8% for new items, legacy rate for older items) |
Agent resale purchasing
Agents purchase resale items using the same x402 protocol:
Direct resale purchase -- buy a specific listing:
GET /v1/secondary/listings/:id/purchase-x402?wallet=0xWALLET
Browse + purchase resale -- auto-select and buy from available resale listings:
GET /v1/secondary/browse-and-purchase-x402?wallet=0xWALLET&tags=cool&maxPrice=25
Both endpoints return the purchased item details, sale metadata, an agentToken, and an optional selfieUrl when selfie=true is set.
See the x402 purchasing guide for protocol details.