@x402r/helpers package provides the refundable() function — a framework-agnostic helper that adds escrow configuration to x402 payment options.
This function lives in
@x402r/helpers, not @x402r/merchant. Install it separately:Usage
extra field populated with escrow addresses and fee bounds.
Function Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
option | PaymentOption | Base payment option (must include network) |
operatorAddress | Address | Your PaymentOperator contract address |
options | RefundableOptions | Optional overrides (see below) |
Options & Defaults
| Option | Default | Description |
|---|---|---|
escrowAddress | From network config | AuthCaptureEscrow contract address |
tokenCollector | From network config | ERC3009PaymentCollector contract address |
minFeeBps | 0 | Minimum acceptable fee (0% = accept zero fees) |
maxFeeBps | 1000 | Maximum acceptable fee (1000 bps = 10%) |
Return Value
The function returns the original option object with anextra field added:
Examples
Basic usage (defaults)
Custom fee bounds
Custom escrow address
Supported Networks
The function automatically resolves addresses from the network config. Unsupported networks throw an error:Integration with x402
Userefundable() when constructing your 402 Payment Required response:
