Skip to main content
The X402r SDK is in active development. APIs may change between releases. Always test on Base Sepolia before using real funds on mainnet.
Three roles interact with the protocol:
  • Merchants receive payments into escrow and capture funds after delivery
  • Payers can request refunds, freeze payments, and submit evidence during disputes
  • Arbiters verify transactions or resolve disputes (two models below)

Two Operator Models

Marketplace (deployMarketplaceOperator): The merchant releases funds after escrow. If the payer contests, they file a refund request and an arbiter resolves it. Use this for general commerce where most transactions clear without dispute. Delivery Protection (deployDeliveryProtectionOperator): The arbiter evaluates every transaction. The arbiter or a satisfied payer can capture funds. On a FAIL verdict, the arbiter can trigger an immediate refund. If nobody acts, funds return to the payer once escrow expires. Use this for AI content verification, schema validation, or quality checks. See Deploy an operator for the full preset feature comparison, slot configurations, and deployment code.

Packages

npm install @x402r/sdk
@x402r/sdk is the only package most developers need. It includes role-scoped client factories, 8 action groups (payment, escrow, refund, evidence, freeze, query, operator, watch), an .extend() plugin system, and ERC-8004 helpers that extract on-chain identity and reputation data from x402 extension responses. For low-level access to contract ABIs and deploy utilities:
npm install @x402r/core
For x402 server integration:
npm install @x402r/helpers
For one-shot payments from the command line (no project install required):
npx @x402r/cli pay <url> [options]

Guides

Merchant guide

Capture funds from escrow, charge directly, void, and process refunds using createMerchantClient.

Deploy an operator

Deploy a PaymentOperator on Base or Base Sepolia and configure plugin slots.

Delivery protection

Wire merchant settlements into an arbiter that gates capture on response quality.

@x402r/cli

Wallet-agnostic one-shot payments from the command line or scripts.

Network support

All x402r-authored contracts use universal CREATE2 addresses: every supported chain resolves to the same address as every other supported chain. Today, the supported chains in @x402r/core are Base and Base Sepolia. More EVM chains land as canonical base/commerce-payments@v1.0.0 coverage extends.
ChainChain IDUSDC
Base84530x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Base Sepolia845320x036CbD53842c5426634e7929541eC2318f3dCF7e

commerce-payments v1 primitives

The base/commerce-payments@v1.0.0 primitives ship at canonical CREATE2 addresses via CreateX permissionless salts. Each contract resolves to the same address on every supported chain.
ContractAddress
AuthCaptureEscrow0xBdEA0D1bcC5966192B070Fdf62aB4EF5b4420cff
ERC3009PaymentCollector0x0E3dF9510de65469C4518D7843919c0b8C7A7757
Permit2PaymentCollector0x992476B9Ee81d52a5BdA0622C333938D0Af0aB26
Salt namespace: commerce-payments::v1::<ContractName>. Import the addresses from @x402r/core:
import { authCaptureEscrow, tokenCollector } from '@x402r/core';

// AuthCaptureEscrow, canonical across every supported chain.
authCaptureEscrow;
// Primary token collector (currently aliases ERC3009PaymentCollector).
tokenCollector;
The SDK exposes these primitives on the chains listed in @x402r/core’s x402rChains (Base + Base Sepolia today). CreateX salts already reserve the CREATE2 addresses on more chains, and the registry enables each one as canonical base/commerce-payments@v1.0.0 coverage extends.