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
- sign in with moonx in your app.
- create a deal (a form posting to your deals endpoint).
- share the deal link. seller
PATCHjoin. buyer funds USDC on-chain, thenPATCHmark_funded. buyer latermark_released(ormark_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)
- human vaults a wallet in paybox and issues a scoped grant to an agent client.
- agent connects
https://api.paybox.sh/mcp. - agent pays/funds toward the address / amount the deal requires (exact tool depends on your flow; start from MCP tools).
- 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).