Escrow for x402 payments

Payments that can come back.

Trestly adds a dispute-aware escrow layer to x402 payments on Stellar. Agents pay. Services deliver. Funds settle only when the window closes.

Built on Stellar
Powered by Soroban

AI AGENT

Sends x402 payment for a service

Trestly Escrow

12.50 USDC

Held in escrow

00:08:42 remaining

API / SERVICE

Delivers the requested service

SERVICE COMPLETES

Release to seller

DISPUTE RAISED

Return to buyer

A smarter way to pay for AI services.

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.

Instant Payments

Keep the speed of x402 with the added protection of escrow.

Dispute-Aware

Funds can return to the buyer if something goes wrong.

Stellar-Native

Built on Stellar and powered by Soroban smart contracts.

Developer Friendly

Simple integration. Powerful APIs. Full transparency.

How it works

Built for real-world AI payments.

  1. 1

    Payment Initiated

    The agent sends an x402 payment for a service.

  2. 2

    Funds Held in Escrow

    Trestly locks the payment in a Soroban smart contract.

  3. 3

    Service Window

    The service is delivered while the dispute window remains open.

  4. 4

    Funds Released or Returned

    Payment releases to the seller — or returns to the buyer if a dispute is raised in time.

Example integration
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?

Integrate Trestly today.

Get started with our developer docs and start using refund-enabled x402 payments on Stellar.