Skip to main content

Install Packages

Install only the packages you need for your use case:
npm install @x402r/client @x402r/core viem

Setup viem Clients

Create publicClient and walletClient using viem. All SDK classes require these as constructor arguments.

Contract Addresses

Get the deployed contract addresses from the network config:
import { getNetworkConfig } from '@x402r/core';

const config = getNetworkConfig('eip155:84532'); // Base Sepolia

console.log(config.authCaptureEscrow); // Escrow contract
console.log(config.refundRequest);     // RefundRequest contract
console.log(config.arbiterRegistry);   // ArbiterRegistry contract
console.log(config.usdc);             // USDC token address
Network identifiers use the EIP-155 format: eip155:<chainId>. For Base Sepolia, use 'eip155:84532'. For Base Mainnet, use 'eip155:8453'.
Never commit private keys to version control. Use environment variables or a secrets manager.

Next Steps

Core Concepts

Learn about payment states, escrow, and the refund lifecycle.

Examples

Working examples for merchants, clients, and arbiters.