@x402r/merchant package provides everything merchants need to handle X402r payments: releasing funds, charging, processing refunds, and managing escrow.
Prerequisites
Before starting, ensure you have:
- Node.js 20+
- A funded wallet on Base Sepolia
- A deployed PaymentOperator (see Deploy Operator)
Installation
Setup
Create the X402rMerchant instance:Release a Payment
Release funds from escrow to the receiver:Charge a Payment
For subscription or session-based flows, charge directly without prior escrow:Handle Refund Requests
Process incoming refund requests:Execute Refunds
After approving, execute the actual refund:Mark Payment Options as Refundable
Use the@x402r/helpers package to add escrow configuration to x402 payment options:
