Skip to main content

Quick Start for Clients

No Code Changes Required!

Since withRefund() changes payTo to the DepositRelay address, clients automatically sign to send money to the correct escrow path.

Optional: Display Refund Information

Clients also receive refund information in the payment response. You can optionally display it:

if (requirements.extra?._x402_refund_merchantPayout) {
console.log('✓ This payment is refundable')
}

Query Escrow Details

Clients can use _x402_refund_merchantPayout to query the escrow contract and surface refund/dispute details:

const option = paymentRequired.accepts[0]
const merchantPayout = option.extra?._x402_refund_merchantPayout

if (merchantPayout) {
const escrowAddress = await escrowFactory.getEscrow(merchantPayout)
const escrow = new Contract(escrowAddress, EscrowABI, provider)
const arbiter = await escrow.arbiter()
const releaseDelay = await escrow.releaseDelay()
// Display arbiter + releaseDelay to the user
}