Escrow for x402 payments
Trestly adds a dispute-aware escrow layer to x402 payments on Stellar. Agents pay. Services deliver. Funds settle only when the window closes.
AI AGENT
Sends x402 payment for a service
Trestly Escrow
12.50 USDC
Held in escrow
API / SERVICE
Delivers the requested service
SERVICE COMPLETES
Release to seller
DISPUTE RAISED
Return to buyer
Standard x402 payments are final the moment they settle. Trestly adds a safety net — escrow with a dispute window — so agents and services can transact with confidence.
Keep the speed of x402 with the added protection of escrow.
Funds can return to the buyer if something goes wrong.
Built on Stellar and powered by Soroban smart contracts.
Simple integration. Powerful APIs. Full transparency.
How it works
The agent sends an x402 payment for a service.
Trestly locks the payment in a Soroban smart contract.
The service is delivered while the dispute window remains open.
Payment releases to the seller — or returns to the buyer if a dispute is raised in time.
import { wrapX402Payment } from "trestly-sdk";
const result = await wrapX402Payment(config, {
payer: buyerAddress,
payee: sellerAddress,
token: usdcAddress,
amount: 125000000n, // 12.50 USDC
disputeWindowSecs: 10 * 60,
arbiter: arbiterAddress,
signTransaction: async (xdr) =>
await freighter.signTransaction(xdr),
});
console.log("Payment ID:", result.paymentId);
console.log("Tx hash:", result.txHash);Ready to build?
Get started with our developer docs and start using refund-enabled x402 payments on Stellar.