x402r-sdk/examples/ directory. Each example is a standalone project that demonstrates a specific integration pattern.
Available Examples
deploy-operator
Deploy a complete marketplace operator with escrow, freeze, and arbiter support.Key concepts:
deployMarketplaceOperator(), factory pattern, CREATE2merchant-server
HTTP server that accepts escrow payments and handles refunds.Key concepts:
refundable(), payment verification, release flowmerchant-cli
CLI tool for merchants to release payments, approve/deny refunds, and query state.Key concepts:
X402rMerchant, release(), approveRefundRequest()client-cli
CLI tool for payers to request refunds, freeze payments, and check status.Key concepts:
X402rClient, requestRefund(), freezePayment()arbiter-cli
CLI tool for arbiters to review cases, make decisions, and manage registry.Key concepts:
X402rArbiter, approveRefundRequest(), registerArbiter()e2e-dispute
End-to-end dispute resolution flow: deploy operator, create payment, freeze, request refund, arbiter resolves.Key concepts: Full lifecycle,
createFacilitatorSigner(), getPaymentInfoFromEvents()shared
Shared utilities used by the CLI examples (display helpers, PaymentInfo formatting).
Running Examples
Each example is a standalone project. To run one:deploy-operator
Deploys a complete marketplace operator usingdeployMarketplaceOperator():
e2e-dispute
The most comprehensive example — runs through the entire dispute lifecycle:- Deploys a fresh operator
- Creates a payment with ERC-3009 authorization
- Payer freezes the payment
- Payer requests a refund
- Arbiter reviews and approves
- Arbiter executes the refund
createFacilitatorSigner() from @x402r/evm and getPaymentInfoFromEvents() from @x402r/arbiter to reconstruct PaymentInfo from on-chain events.
merchant-server
Demonstrates a minimal HTTP server that:- Returns 402 with
refundable()payment options - Verifies incoming payments via the facilitator
- Watches for refund requests
- Auto-approves or requires manual review
