1. Install the package
2. Register the scheme and wrap fetch
registerAtumEscrowScheme reads the selected 402 option’s extra.atum (destination, deadlines, settlement vault/proxy/role addresses), builds the Atum payment request, and signs the source-side Permit2 authorization for the settlement vault deposit.
Before it signs anything, the client checks the merchant’s terms and refuses the payment with an AtumEscrowTrustError if they fail. See What payers check before signing. Paying through a deployment other than Atum’s production gateways? Pass your own trust to registerAtumEscrowScheme, or every payment is refused.
3. Restrict source networks (optional)
registerAtumEscrowScheme registers under the eip155:* wildcard by default — pass an explicit networks list to restrict which source chains your agent will fund from:
Chain IDs, tokens, and addresses in these snippets are illustrative placeholders. Use Supported networks and Supported assets for the live catalog.
4. Build a payment without sending it (optional)
If you’d rather build a payment without immediately sending the request — for example to inspect it, log it, or drive a facilitator’s/verify directly — read the 402 yourself and build the payload from the HTTP client wrapper (x402HTTPClient, which wraps your x402Client): httpClient.createPaymentPayload(paymentRequired), instead of using wrapFetchWithPayment.