Skip to main content
The x402r-sdk repository ships runnable example scripts organized by role plus end-to-end scenarios.

Examples

payer

Request a refund, freeze a payment, submit on-chain evidence (a placeholder CID; the integrator owns IPFS pinning). Three TypeScript scripts.

merchant

Capture from escrow and charge directly. TypeScript scripts plus README.

arbiter

Approve a refund, review on-chain evidence, distribute protocol fees.

scenarios

End-to-end runners: happy-path capture, dispute resolution, atomic charge, partial refund flow. Wires payer + merchant + arbiter together against a local Anvil fork.

shared

Shared setup utilities: Anvil-fork bootstrap, constants, common types.

Running examples

All examples run against a local Anvil fork seeded by shared/anvil-setup.ts. You do not need a mainnet wallet or funding.
git clone https://github.com/BackTrackCo/x402r-sdk.git
cd x402r-sdk
pnpm install && pnpm build
The SDK uses pnpm workspaces (pnpm@10.23.0). The npm runtime is fine for application code that consumes published @x402r/* packages, but the workspace clone above expects pnpm or a workspace-aware install. See each example directory’s README on GitHub for the exact run command for that script.

Next steps

Deploy an operator

Walk through deployMarketplaceOperator() and deployDeliveryProtectionOperator().

forwardToArbiter()

Forward auth-capture settlements to an arbiter service.

GitHub

Browse every example.