Ax402Docs
SDKS

TypeScript

@ax402/sdk + /buyer + /platform

@ax402/sdk mirrors the control-plane REST contract and includes a /buyer module for paying gateway URLs. Subpaths: main entry, /buyer, /platform, /scopes, /shell.

Source: github.com/AxLabs/ax402-sdks (packages/typescript/).

Install

npm install @ax402/sdk
# Buyer deps (required for /buyer)
npm install @x402/fetch @x402/evm viem

Control plane

import { Ax402Client, buildUsdcAccept, usdcToAtomic } from "@ax402/sdk";

const client = new Ax402Client({
  baseUrl: process.env.AX402_BASE_URL!,
  apiKey: process.env.AX402_API_KEY!,
});

const apis = await client.apis.list();
await client.endpoints.create(apiId, {
  method: "GET",
  path_pattern: "/v1/*",
  accepts: [buildUsdcAccept("exact", usdcToAtomic("0.10"))],
});

Resources: auth (incl. MFA, passkeys), keys, apis (incl. batch overview/settings), endpoints, domains, openapi, stats, settlements, billing, income, exchangeRates, config. Broadest SDK — includes facilitator stats and global payment history.

Buyer module

Pay gateway hostnames, not the control plane. Full guide: Buyer clients.

import { buyerClientFromEnv } from "@ax402/sdk/buyer";

const client = await buyerClientFromEnv();
const { response, payment } = await client.pay({
  url: "https://my-api.ax402.io/v1/foo",
});

Batch-settlement gateways:

const client = await buyerClientFromEnv({ batch: { depositMultiplier: 5 } });

Browser wallet: createEvmSignerFromBrowserProvider() + BuyerClient.create(signer).

Platform helpers

  • SCOPE_PRESETS, SCOPE_LABELS — API key scopes
    • usdcToAtomic, buildUsdcAccept, buildBatchUsdcAccept
    • gatewayURL, setupApiWithDefaultDomain
    • wrapOpenAPI — bulk endpoint import

On this page