Why x402?
In the agentic economy, payments are no longer initiated solely by humans via web interfaces. Machines need a way to:- Discover Payment Terms: Understand costs before execution.
- Negotiate Parameters: Handle variable pricing or volume discounts.
- Execute Autonomously: Settle transactions without human-in-the-loop approvals.
- Verify Cryptographically: Ensure the identity and authorization of both parties.
Rem’s x402 Implementation
Rem provides a suite of tools to make x402 adoption seamless for institutions.1. Middleware for Hono & Express
We provide drop-in middleware that handles the x402 handshake and request/response lifecycle.2. Header-Based Negotiation
x402 utilizes custom HTTP headers to communicate payment requirements between the agent and the gateway.X-402-Payment-Required: Sent by the server when a payment is needed.X-402-Wallet-Address: The destination for the machine-to-machine transfer.X-402-Status: Real-time settlement status.
3. Integration with Circle
Rem’s x402 middleware is pre-wired to resolve payments via the Circle Payment Network, ensuring that sub-second settlement on Solana, Base, or Tempo is immediately reflected in the x402 state machine.Technical Workflow
- Initial Request: An agent attempts to access a protected resource.
- Rejection (402): The server returns a
402 Payment Requiredstatus with x402 headers defining the cost. - Settlement: The agent’s wallet (managed via Rem or MCP) executes a transfer on-chain.
- Verification: The Rem gateway detects the on-chain event and updates the x402 session.
- Success: The agent retries the original request, which now passes the x402 verification check.
Use Cases
Compute Reselling
Automated settlement for GPU or inference time based on usage.
Data Marketplaces
Pay-per-query access for LLM training or real-time data feeds.
Agentic Commerce
AI agents purchasing APIs, services, or physical goods.
Ad Networks
Real-time bidding and settlement for machine-driven advertising.
View API Reference
See how to implement x402 endpoints in your own applications.

