Refund Protocol for Agents

x402 Refund Protocol

A standard for open, transparent, and automated refund processing for x402. Built for developers, designed for openness.

Currently in alpha · APIs may change

Few lines to Enable Refunds

Pick your arbiter, deploy your escrow contract, mark routes as refundable, and let the protocol handle disputes. Minimal changes required.

Resource Server

TypeScript

import { EscrowServerScheme } from "@x402r/evm/escrow/server";
import { refundable } from "@x402r/helpers";
...
app.use(
  paymentMiddleware(
    {
      "GET /weather": {
        accepts: [
          refundable({
            scheme: "escrow",
            price: "$0.01",
            network: NETWORK_ID,
            payTo: account.address,
          }, operatorAddress),
        ],
        description: "Weather data",
      },
    },
    new x402ResourceServer(facilitatorClient)
      .register(NETWORK_ID, new EscrowServerScheme()),
  ),
);

Facilitator

TypeScript

import { registerEscrowScheme } from "@x402r/evm/escrow/facilitator";
...
const facilitator = new x402Facilitator();

registerEscrowScheme(facilitator, {
  signer: evmSigner,
  networks: NETWORK,
});

Ecosystem Partners

Building the future of refundable payments with innovative partners across the ecosystem.

x402 facilitators

What x402r Offers

The x402 refund protocol provides a standardized, secure, and customizable way to handle refunds for merchants.

Non-custodial

Funds can only go to the merchant or user, nowhere else. No third-party custody or risk

Transparent

Source-available contracts with on-chain verification and full traceability of all transactions

Arbiter Agnostic

Choose your own operator for escrow and dispute resolution, maintaining full control over the process

Minimal Changes

Very little changes to your current code are required to enable refund functionality

Configurable

Conditions, escrow periods, and dispute resolution are all pluggable and customizable per operator

Flexible Fees

Arbiters set their own fee structure. Transparent, on-chain, and fully configurable