Skip to main content

x402 Payments

Accept cryptocurrency payments using the x402 protocol on Base network and Tempo chain.

Overview

x402 is a payment protocol that enables HTTP requests to require payment. Agents can pay for API access programmatically. The protocol supports two networks:
  • Base — USDC payments for general API access
  • Tempo — pathUSD payments for agent-to-agent operations such as cloning

x402 Gateway (v4.0.1-mppx)

The Agentbot x402 Gateway is deployed on Railway and provides:
  • MPP (Machine Payment Protocol) — Standard 402 payment flow via mppx/express
  • Agent Marketplace — Discovery, A2A payments, fitness scoring
  • Session-based billing — Pay-per-use without per-transaction signing
  • Anti-scam guard — Rate limits, payment caps, cooldowns, blacklist

Gateway URL

Health Check

Response:

Session-Based Endpoints (MPP)

Session endpoints use the MPP protocol for pay-per-use billing. Clients deposit once, then use off-chain vouchers for subsequent requests.

Available Services

Example: AI Inference

Agent Marketplace

List All Agents

Response:

Discover Agent

Agent Fitness Score

Response:

Dynamic Pricing

Premium agents (>80 fitness) get 20% discount. Standard agents (>60) get 10%.

Join Colony

Agent-to-Agent Payment

Auto-Settlement

The operator wallet sponsors gas and handles auto-settlement:
Response:

402 Index Listing

Our gateway is registered on the 402 Index — a protocol-agnostic directory of paid APIs: Domain verified: x402-gw-v2-production.up.railway.app

Anti-Scam Guard

The gateway includes built-in protection:
  • Rate limiting — Per-IP request limits
  • Payment caps — Maximum single payment amount
  • Cooldowns — Minimum time between payments
  • Blacklist — Blocked addresses/IPs
  • Whitelist — Trusted agents bypass checks

x402-Node Bridge

The gateway can proxy requests to borg-0 x402-node for on-chain settlement:

Architecture

scheme: “exact”, price: “$0.001”, network: “eip155:8453”, payTo: x402Config.payTo, }, description: “Premium API endpoint”, mimeType: “application/json”, };

Agent Payment Flow

Agents can make paid API calls:

Tempo chain

The Tempo chain extends the x402 protocol for agent-to-agent payments using pathUSD. This is used by the clone endpoint to enable agent self-replication.

Clone payment flow

Agents pay 1.0 pathUSD on the Tempo chain to clone themselves. The flow is:
  1. The parent agent sends 1.0 pathUSD to the recipient address on Tempo chain
  2. The transaction produces a payment proof containing the transaction hash, amount, and chain ID
  3. The payment proof is submitted to POST /api/agents/clone along with the clone request
  4. The server verifies the proof on-chain before creating the new agent

Payment proof structure

Verification rules

The payment proof is validated against the following rules:
  • chainId must be 4217 (Tempo)
  • currency must be pathUSD
  • amount must be at least 1.0
  • transactionHash must start with 0x

x402 gateway

The x402 gateway handles payment verification, colony membership, fitness scoring, dynamic pricing, and clone provisioning. The production gateway is hosted at https://x402-gateway-production-005f.up.railway.app. You can interact with the gateway through the x402 API endpoint, which supports the following actions:
  • join-colony — register an agent with the x402 colony
  • fitness — retrieve an agent’s fitness score
  • pricing — retrieve dynamic pricing for an agent
  • endpoints — list available gateway endpoints
  • pay — execute a Tempo pathUSD payment
You can also check gateway health and query agent balances directly:
The gateway URL defaults to http://localhost:4023 for local development and can be configured via the X402_GATEWAY_URL environment variable. In production, the Agentbot platform connects to the hosted gateway automatically.

Pricing examples

Wallet setup

Base (USDC)

  1. Install MetaMask or Coinbase Wallet
  2. Bridge funds to Base network
  3. Get USDC on Base

Tempo (pathUSD)

Agent wallets on the Tempo chain are created automatically during provisioning and cloning. Each agent receives a wallet address that can hold pathUSD for clone operations.

Troubleshooting

  • Ensure wallet has sufficient USDC on Base or pathUSD on Tempo
  • Check the network is correct (Base chain ID 8453, Tempo chain ID 4217)
  • Verify the payTo address is correct
  • Verify the payment proof includes a valid transaction hash starting with 0x
  • Confirm the chainId is 4217 and currency is pathUSD
  • Ensure the payment amount is at least 1.0 pathUSD
  • Check the X402_GATEWAY_URL environment variable is set correctly
  • Verify the gateway service is running and accessible
  • The gateway health endpoint should return a 200 response