Proxy

🧩 Latch Payment Proxy

The Latch Payment Proxy is a high-performance coordination layer that verifies on-chain payments, settles x402 transactions, and forwards authorized requests between clients and upstream APIs — enabling pay-per-call access without changing backend logic.


⚙️ How It Works

Client → Latch Payment Proxy → Your API

Flow Overview

  1. Request – The client sends an API or MCP call through the proxy.

  2. 402 & Pricing – If the route is monetized, the proxy returns x402 metadata (asset, amount, recipient, expiry).

  3. Payment Verification – The client (or delegated policy) pays on-chain; the proxy validates settlement.

  4. Forward & Respond – Once payment is confirmed, the proxy retries the original request, forwards it to your API, and streams back the response.

This flow allows any API to become pay-protected at the protocol level — stateless and trust-minimized.


🛠 Configuration

You can register and configure payable endpoints through the Latch Console or directly via SDK.

1. Register Your API

  • Import from OpenAPI spec (recommended) or define manually.

  • Add authentication headers or query parameters used by your backend.

  • Specify recipient wallet and supported chain (e.g., Base, Solana, Polygon).

2. Set Pricing

  • Define per-request pricing (e.g., $0.01 USDC or 0.05 LATCH).

  • Choose payment timing:

    • Async – Verify payment asynchronously (fastest).

    • Before – Settle payment before execution.

    • After – Verify after execution (safest).

3. Settlement Mode

Select the strictness of on-chain verification:

  • Simulated – Marked valid after simulation (for testing).

  • Submitted – Valid once broadcast to the network.

  • Confirmed – Waits for full on-chain confirmation (highest assurance).


🧱 API Metadata

When using an OpenAPI spec, metadata (methods, inputs, and response schemas) are auto-imported. This ensures that MCP clients and AI agents can understand and interact with your API autonomously.

Manual configuration is also supported by defining method, path, parameters, and schemas directly.


🧪 Testing

Within the Latch Console, you can test your payable endpoints:

  • Connect your wallet to simulate a payment.

  • The proxy executes the full x402 payment-verification flow.

  • You receive your API response plus a full payment log trace.


🔒 Design Goals

Goal
Description

Reliability

Stateless architecture with built-in retry and failover via Latch Facilitator

Security

On-chain payment validation before forwarding

Flexibility

Works with REST, MCP, and OpenAPI

Interoperability

Native compatibility with MCP clients and x402 agents

Scalability

Optimized for edge and serverless environments


🌐 Endpoint

Mainnet: https://x402.latchmcp.app Explorer: x402scan link

Last updated