A standard for open, transparent, and automated refund processing for x402. Built for developers, designed for openness.
Currently in alpha · APIs may change
Pick your arbiter, deploy your escrow contract, mark routes as refundable, and let the protocol handle disputes. Minimal changes required.
TypeScript
import { refundable, withRefund } from '@x402r/extensions/refund';
...
app.use(paymentMiddleware(
withRefund({
'GET /api/data': {
accepts: [
refundable({
scheme: 'exact',
payTo: '0xmerchant123...',
price: '$0.001',
network: 'eip155:8453',
}),
],
description: 'API data endpoint',
},
}, FACTORY_ADDRESS),
));TypeScript
import { settleWithRefundHelper } from '@x402r/extensions/refund';
...
facilitator.onBeforeSettle(async (context) => {
const { paymentPayload, paymentRequirements } = context;
const result = await settleWithRefundHelper(
paymentPayload,
paymentRequirements,
facilitator.signer
);
return result ? { abort: true } : null;
});Building the future of refundable payments with innovative partners across the ecosystem.
x402 facilitators
The x402 refund protocol provides a standardized, secure, and customizable way to handle refunds for merchants.
Funds can only go to the merchant or user, nowhere else. No third-party custody or risk
All contracts are open source and auditable, ensuring complete transparency
Choose your own arbiter or dispute resolver, maintaining control over the process
Very little changes to your current code are required to enable refund functionality
On-chain verification and complete traceability of all transactions
No fees for users or merchants. Revenue comes from lending the escrow float in DeFi protocols