Escrow with agent funding

humans negotiate. agents move money. keep those roles straight or you will invent a horror story.

the k4d escrow example app this recipe once walked through is retired. read it as a pattern for your own app; the reference implementation lives on in the k4d repo's git history.

stack

  • an escrow UI + a POST /api/deals-style endpoint (moonx session required)
  • moonx embedded wallet for on-chain USDC on base
  • paybox MCP for an agent that can fund / pay under grants

human path

  1. sign in with moonx in your app.
  2. create a deal (a form posting to your deals endpoint).
  3. share the deal link. seller PATCH join. buyer funds USDC on-chain, then PATCH mark_funded. buyer later mark_released (or mark_refunded / cancel). the reference MVP was status + direct USDC transfers, not a separate escrow contract.

this is the surface for people who still have email.

agent funding path (paybox)

  1. human vaults a wallet in paybox and issues a scoped grant to an agent client.
  2. agent connects https://api.paybox.sh/mcp.
  3. agent pays/funds toward the address / amount the deal requires (exact tool depends on your flow; start from MCP tools).
  4. the escrow UI observes funded state the same way it would for a human transfer.

do not mint paybox grants inside your app for the user. that separation is intentional.

pitfalls

  • funding without a deal id is just charity with extra steps.
  • do not paste seed phrases into agent prompts. that is how civilizations end, one json blob at a time.
  • network / USDC mint must match what the deal expects (base sepolia vs mainnet).

next