02 ⊢Examples

Recipes agents can copy.

Worked flows for discovery, marketplace listings, and live demos. Each recipe maps to the same contract object: create, fund, verify, settle.

sandbox

Run the full lifecycle with zero real money.

Create with network: "base-sepolia" and every step runs on testnet USDC: create, fund via x402, verify, payout, settled. This is the recommended first contract.

# 1. Create a sandbox contract. Full lifecycle, faucet USDC, no real money.
curl -X POST https://settle.ronakdaya.com/escrow/create \
  -H 'content-type: application/json' \
  -d '{"network":"base-sepolia","amount_usdc":1,"client_wallet":"client","provider_wallet":"provider","condition":{"type":"api_response","params":{"url":"https://example.com/result","expected_status":"200"},"deadline":"2026-12-31T00:00:00.000Z","fallback":"return_to_client"}}'

# 2. Get Base Sepolia USDC from a faucet (Circle or Coinbase CDP faucets).

# 3. Fund via x402. Bare call returns 402 + PaymentRequirements;
#    x402 clients retry with a signed X-PAYMENT header automatically.
curl -X POST https://settle.ronakdaya.com/escrow/{id}/fund-x402

# 4. Claim payout details, then verify. Deterministic conditions
#    auto-authorize payout.
curl -X POST https://settle.ronakdaya.com/escrow/{id}/verify
railUSDC on Base Sepolia · x402
cost$0 · faucet money
why this works

The funding wall was the v0.1 dropoff. The sandbox removes it without changing the contract shape.

402 challenge (no X-PAYMENT)
{
  "x402Version": 1,
  "error": "payment_required",
  "accepts": [{
    "scheme": "exact",
    "network": "base-sepolia",
    "maxAmountRequired": "1000000",
    "payTo": "0x...",
    "asset": "0x036C...DCF7e",
    "extra": { "name": "USDC", "version": "2" }
  }]
}
funded response (signed X-PAYMENT)
{
  "ok": true,
  "id": "stl_...",
  "state": "held",
  "network": "base-sepolia",
  "tx_hash": "0x..."
}
cloudflare_agents

Fund conditional work from a Cloudflare Agent.

Cloudflare Agents handle pay-to-access through HTTP 402. Settle uses the same x402 retry shape to fund escrow, then waits for proof before payout.

// Cloudflare Agent using Settle for conditional settlement.
// Use paidTool / withX402 for immediate access.
// Use Settle when payout should wait for proof of completed work.

const contract = await fetch("https://settle.ronakdaya.com/escrow/create", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "Idempotency-Key": crypto.randomUUID()
  },
  body: JSON.stringify({
    network: "base-sepolia",
    amount_usdc: 1,
    client_wallet: "cloudflare-agent",
    provider_wallet: "provider",
    condition: {
      type: "api_response",
      params: { url: "https://example.com/result", expected_status: "200" },
      deadline: "2026-12-31T00:00:00.000Z",
      fallback: "return_to_client"
    }
  })
}).then((r) => r.json());

const fundUrl = "https://settle.ronakdaya.com/escrow/" + contract.id + "/fund-x402";

// Wrap this fetch with the Cloudflare Agents x402 client.
// Bare request returns 402 PaymentRequirements; retry with X-PAYMENT moves escrow to held.
const funded = await fetch(fundUrl, { method: "POST" }).then((r) => r.json());
clientwithX402Client · Agents SDK
railBase Sepolia sandbox · USDC
why this works

The payment handshake stays standard. The settlement condition lives in Settle.

agent flow
tool request -> 402 challenge
x402 client signs X-PAYMENT
Settle moves escrow to held
condition passes
payout confirms
settled
where Settle fits
Use paidTool for immediate access.
Use Settle when payment waits for proof:
PR merged, API returned, file delivered.
verifiable_intent

Prove a human authorized the agent.

Settle verifies Verifiable Intent credential chains (open draft spec v0.1) at create time: every signature, every layer binding, and the human's spending cap against the funds being committed. Invalid chains reject the create.

# Create an escrow carrying proof a human authorized the agent.
# verifiable_intent is the merchant-view Verifiable Intent chain
# (open draft spec v0.1: github.com/agent-intent/verifiable-intent).
curl -X POST https://settle.ronakdaya.com/escrow/create \
  -H 'content-type: application/json' \
  -d '{
    "amount_usdc": 5,
    "client_wallet": "client",
    "provider_wallet": "provider",
    "condition": {"type":"manual","params":{},"deadline":"2026-12-31T00:00:00.000Z","fallback":"return_to_client"},
    "verifiable_intent": {
      "l1": "<issuer SD-JWT>~",
      "l2": "<user KB-SD-JWT>~<checkout disclosure>~<payment disclosure>~",
      "l3b": "<agent KB-SD-JWT>~<final checkout disclosure>~"
    }
  }'
specagent-intent/verifiable-intent · 0.1-draft
cryptoES256 · SD-JWT · no new primitives
why this works

An escrow carrying cryptographic proof of human authorization is a better escrow in a dispute.

stored on the contract
{
  "verifiable_intent": {
    "spec": "verifiable-intent",
    "spec_version": "0.1-draft",
    "verified": true,
    "mode": "autonomous",
    "prompt_summary": "Escrow up to $2...",
    "amount_enforced": true
  }
}
invalid chain
HTTP 400
{
  "error": "verifiable_intent_invalid",
  "detail": ["amount_above_mandate_max"]
}
funding_test

Create, fund, and reconcile a $1 Base USDC contract.

This is the shortest path from discovery to a real funded state. Use exact Base USDC. There is no memo on Base or X Layer.

# 1. Create a tiny deterministic contract.
curl -X POST https://settle.ronakdaya.com/escrow/create \
  -H 'content-type: application/json' \
  -H 'Idempotency-Key: test-001' \
  -d '{"amount_usdc":1,"gas_tip_percent":0,"client_wallet":"client","provider_wallet":"provider","condition":{"type":"api_response","params":{"url":"https://example.com/result","expected_status":"200"},"deadline":"2026-12-31T00:00:00.000Z","fallback":"return_to_client"}}'

# 2. Get the Base USDC deposit address.
curl -X POST https://settle.ronakdaya.com/escrow/{id}/fund-usdc-base

# 3. Send exact USDC on Base. No memo.

# 4. If needed, reconcile from the tx hash.
curl -X POST https://settle.ronakdaya.com/escrow/{id}/sync-funding \
  -H 'content-type: application/json' \
  -d '{"rail":"base_usdc","tx_hash":"0x..."}'
railUSDC on Base
fallbackPOST /escrow/{id}/sync-funding
why this works

The chain is the source of truth. Webhooks accelerate; receipt sync reconciles.

funding response
{
  "deposit_address": "0x...",
  "amount": 1,
  "currency": "USDC",
  "chain": "base",
  "memo": null
}
sync response
{
  "ok": true,
  "id": "stl_...",
  "state": "held",
  "rail": "base_usdc",
  "tx_hash": "0x..."
}
base_agent_task

Use a Base agent wallet for conditional work.

Base and Coinbase agent wallets can handle funding, x402, and spend caps. Use Settle when USDC should wait for proof before payout finalizes.

Read https://settle.ronakdaya.com/skill.md.
Use my Base agent wallet to fund a $10 USDC escrow on Base.
Settle only when https://api.example.com/result returns 200 and contains "done".
Register the provider payout address before verification so payout can auto-authorize.
railUSDC on Base
agent stackBase · Coinbase Agentic Wallets · x402
why this works

Wallet control, payment, and conditional settlement stay separate.

agent flow
{
  "wallet": "Base Account, Coinbase Agentic Wallet, or MCP-controlled wallet",
  "funding": "usdc/base",
  "condition": "api_response",
  "settlement": "after receipt sync"
}
when to use Settle
Use x402 for pay-to-access.
Use Settle when payment waits for proof:
PR merged, API returned, file delivered.
github_pr_merged

Pay a contributor when a PR merges.

For code bounties and agent-generated patches. Deterministic verification can auto-authorize payout once payout details are registered.

Read https://settle.ronakdaya.com/skill.md and create a test escrow for $25 USDC.
Settle only when GitHub PR owner/repo#42 is merged.
Fallback: return funds to the client if the deadline expires.
evidencemerge_sha + merged_at
webhookescrow.settled
why this works

GitHub merge state is objective and repeatable.

expected evidence
{
  "kind": "github_pr_merged",
  "repo": "owner/repo",
  "pr": 42,
  "merge_sha": "4f1c…9d3a",
  "merged_at": "2026-05-24T17:01:58Z"
}
webhook payload
{
  "type": "escrow.settled",
  "contract_id": "stl_8f2k…3R",
  "state": { "from": "settlement_pending", "to": "settled" },
  "settlement": { "tx_hash": "0xabc…789" }
}
api_response

Pay when an API returns the agreed result.

For background jobs, paid tool calls, data enrichment, and long-running workflows with a machine-checkable output.

curl -X POST https://settle.ronakdaya.com/escrow/create \
  -H 'content-type: application/json' \
  -d '{"amount_usdc":10,"client_wallet":"client","provider_wallet":"provider","condition":{"type":"api_response","params":{"url":"https://api.example.com/result","expected_status":"200","expected_body":"ok"},"deadline":"2026-12-31T00:00:00.000Z","fallback":"return_to_client"}}'
evidencestatus + matched body
webhookescrow.settled
why this works

The HTTP response is the contract's completion proof.

expected evidence
{
  "kind": "api_response",
  "status": 200,
  "matched_body": true,
  "url": "https://api.example.com/result"
}
webhook payload
{
  "type": "escrow.settled",
  "contract_id": "stl_api…004",
  "evidence": { "kind": "api_response", "status": 200 },
  "settlement": { "tx_hash": "0xabc…789" }
}
file_delivered

Pay when a file is delivered.

For reports, exports, designs, media, and freelancer work where a URL and optional hash can prove delivery.

Read https://settle.ronakdaya.com/skill.md and create an escrow for a file delivery.
Settle when https://example.com/final.zip is available and its sha256 matches the contract.
Use USDC on Base or USDG on X Layer for funding.
evidenceurl + sha256
webhookescrow.settled
why this works

The delivered bytes can be fetched and hashed at the edge.

expected evidence
{
  "kind": "file_delivered",
  "url": "https://example.com/final.zip",
  "sha256": "4f1c…9d3a",
  "hash_matched": true
}
webhook payload
{
  "type": "escrow.settled",
  "contract_id": "stl_file…240",
  "evidence": { "kind": "file_delivered", "hash_matched": true },
  "settlement": { "tx_hash": "0xabc…789" }
}
manual

Pay when a client confirms a milestone.

For work with subjective acceptance. Manual confirmation is explicit, logged, and does not pretend to be deterministic.

curl -X POST https://settle.ronakdaya.com/escrow/create \
  -H 'content-type: application/json' \
  -d '{"amount_usdc":50,"client_wallet":"client","provider_wallet":"provider","condition":{"type":"manual","params":{},"deadline":"2026-12-31T00:00:00.000Z","fallback":"return_to_client"}}'

curl -X POST https://settle.ronakdaya.com/escrow/{id}/verify \
  -H 'content-type: application/json' \
  -d '{"confirmed":true}'
evidenceconfirmed: true
webhookescrow.settled
why this works

Human judgment stays human, but the contract records the decision path.

expected evidence
{
  "kind": "manual",
  "confirmed": true,
  "note": "manual is the escape hatch, not the default"
}
webhook payload
{
  "type": "escrow.settled",
  "contract_id": "stl_manual…100",
  "evidence": { "kind": "manual", "confirmed": true },
  "settlement": { "tx_hash": "0xabc…789" }
}
marketplace listing

Settle

Programmable escrow for agent work. Commit funds upfront. Settle after a verifiable condition passes.

category
conditional settlement
primary
POST /escrow/create
payment
POST /escrow/{id}/pay
AgentCash
Use POST /x402/contract-draft as the paid, discoverable entrypoint.
status
v0.1 custodial demo. Tiny amounts only.
rails
USDC/Base · USDG/X Layer · x402 · MPP · Stripe sandbox
cloudflare agents
Use the x402 client retry loop to fund /escrow/{id}/fund-x402.
agent wallets
Use Base or Coinbase agent wallets for funding. Use Settle when payment waits for proof.
escrowconditional-settlementx402MPPAgentCashPonchoCloudflare AgentsBasebase-usdcagent-walletagent-paymentsbountiesgithubapi-jobsfile-delivery
Ready to settle when the condition fires.