Quick Start for Merchants
1. Deploy Your Escrow Contract
Contact your escrow service provider or use our escrow factory contract at x402r-contracts.
There will be a 1:1 mapping for easy lookups: escrow contract address ↔ merchant payout address
2. Install the Package
npm install @x402/extensions
3. Mark Routes as Refundable
import { refundable, withRefund } from '@x402/extensions/refund'
const routeConfig = {
accepts: refundable({
scheme: 'exact',
payTo: MERCHANT_PAYOUT,
price: '$0.001',
network: 'eip155:84532',
}),
}
const processed = withRefund(routeConfig, DEPOSIT_RELAY_ADDRESS)
What Happens Under the Hood
refundable()stores your original merchant payout address inextra._x402_refund_merchantPayoutwithRefund()processes the route config and:- Sets
payToto the DepositRelay address for all refundable options - Preserves the original merchant address in the
extrafield
- Sets
That's it! Payments to this route now go through escrow.