PoC for x402 refunds using seller signed receipts
x402-refunds-poc is an early-stage Solidity project in the AI payments / x402 ecosystem, focused on crypto, evm, x402. It currently has 1 GitHub stars and 0 forks, and sits alongside related tools like x402-dart, x402-stablecoin, x402-pay.
An autonomous refund mechanism for x402 payments using EIP-712 signed refund authorizations and bonded escrow.
In the traditional x402 flow, clients must pay upfront for API requests. If the server fails to deliver the service after payment, clients need an autonomous way to instantly recover their funds without relying on manual dispute resolution.
This approach requires all the servers to lock-up some USDC in an escrow contract. When requests fail, servers sign refund authorizations that clients can submit on-chain to claim refunds directly from the bond. This creates accountability without any human intervention or intermediaries
Note: This is a basic approach that relies on sellers honestly signing refund authorizations for failed requests. A production system would need a better trust model.


Before making paid requests:
/escrow endpoint to get escrow contract addressisHealthy() on escrow to verify sufficient funds for refunds
When a paid request fails:
{requestCommitment, amount, signature}BondedEscrow.sol manages the bonded escrow:
deposit()The requestCommitment is computed as:
keccak256(method, url, xpayment_header, window)
Servers must expose /escrow endpoint:
app.get("/escrow", (_, res) => {
res.json({ success: true, address: BOND_ESCROW_ADDRESS });
});
This allows clients to:
isHealthy() to verify sufficient bonded fundsServers should always sign the failed requests by implementing better error handling.
However, this approach cannot handle if server crashes or internal server errors
Terminal 1 - Facilitator:
pnpm facilitator
Terminal 2 - Resource Server:
pnpm server
Terminal 3 - Client:
pnpm client
The client will:
/fail endpointDisclaimer: This project is for educational purposes only. The smart contracts are not audited and may contain vulnerabilities. Use at your own risk. Do not use with real funds on mainnet.
Dart implementation of the x402 payment protocol. 🎯
💰 Streamline payments for AI agents using HTTP 402 with yield-bearing Sperax USDs on Arbitrum for fast, cost-effective transactions.
Open-source x402 payment processor for AI agents. Sub-400ms settlement on Solana + 7 EVM chains. Let LLMs pay for APIs programmatically with USDC. npm: nory-x402
Open Source AI trading agent that operates autonomously across 1000+ markets - Polymarket, Kalshi, Binance, Hyperliquid, Solana DEXs, 5 EVM chains. Scans for edge, executes instantly, manages risk while you sleep. Agent commerce protocol for machine-to-machine payments. Self-hosted. Built on Claude.
Drop-in OpenAI Python client with transparent x402 payment support.
Drop-in OpenAI Typescript client with transparent x402 payment support.
TypeScript Interface for Machine Payments Protocol
Production-ready x402 facilitator server.
Rust SDK for the x402 payment protocol.