x402 Payment Integration

x402 is an open HTTP payment protocol by Coinbase. It uses the HTTP 402 status code to enable pay-per-request data access with no accounts or API keys. Verilex accepts payments on all x402-supported chains.

How it works

  1. 1. Client sends a request: GET /api/v1/npi?state=CA
  2. 2. Server returns HTTP 402 with payment options across all supported chains (price, wallet address, network).
  3. 3. Client picks any supported chain and signs a USDC payment.
  4. 4. Client retries the same request with a Payment-Signature header.
  5. 5. Server verifies the payment, returns the data with HTTP 200 and a settlement proof.

Using the x402 client

npm install @x402/client
import { x402Client } from "@x402/client";

const client = x402Client({
  privateKey: process.env.WALLET_PRIVATE_KEY,
});

// The client automatically handles 402 → pay → retry
// It picks the best chain from the server's offered options
const response = await client.get(
  "https://api.verilexdata.com/api/v1/npi?state=CA&specialty=Cardiology"
);

console.log(response.data); // NPI provider results

Supported chains

Every paid endpoint accepts payment on any of these chains. Same price on all networks.

Chain Network ID Token
Base eip155:8453 USDC
Polygon eip155:137 USDC
Avalanche C-Chain eip155:43114 USDC
Sei eip155:1329 USDC
Solana solana:mainnet USDC
Aptos aptos:1 USDC
Stellar stellar:pubnet USDC

Tip: The x402 client library automatically selects a chain from the server's offered options. If you have USDC on multiple chains, it will use the one with the lowest gas fees.

How can we help?

Choose a category and tell us what you need.