1 · The rules
Two numbers the store chooses, and four rules it could switch off. Everything else stays on, whatever you choose.
- Refunds must match an open return recordWhat actually came back: the amount the return allows, minus what is already refunded or reserved, checked against Braintree's own line items.
- The call must match what the Reader readAmount, order, return record and currency in the agent's call equal the Reader's hand-off from the e-mail.
- A person confirms every chargeThe store holds no record of how many the customer wants, so a reorder waits for the itemised total to be confirmed.
- A chargeback locks refundsWhile a dispute the store hasn't won is open on a sale, no refund goes out on it; Braintree's webhook sets the lock.
Always on: who owns the order · what data a sender may read · the agent's tool list · catalog price × quantity · the store's currency · repeated or unknown refunds · the refund ledger at the moment of payment.
2 · What if
Pick a request and send its call through the gate twice: with HOMI's defaults and with your rules. No model and no money: the store's records and the gate only.
3 · Who decides held calls
- Who
- The store manager
- Approval
- Single use, expires after 30 minutes, bound to the exact call the manager saw; every check runs again before the money moves.
- Where
- The review step in the store, the evidence review desk, or the approval desk the MCP server opens for Claude Desktop.
4 · Connect
- Payment rail
- …
- Webhooks
- …
- PayPal REST
- Needs a PayPal account. PayPal accounts can't be opened from Türkiye; the gated PayPal REST rail behind the Agent Toolkit's create_refund is ready and tested with a faked HTTP layer.
- Your AI agent
- Any MCP client (Claude Desktop, Cursor, Claude Code) calls the Agent Toolkit's create_refund(capture_id, amount) through Counterfoil. Add this entry to the client's config; the keys stay in your .env:
{
"mcpServers": {
"counterfoil": {
"command": "/path/to/counterfoil/.venv/bin/python",
"args": ["/path/to/counterfoil/scripts/counterfoil_mcp.py", "serve",
"--scenario", "P6-01", "--rail", "braintree"]
}
}
}
5 · Your records
Counterfoil decides from the store's own records, never from the customer's e-mail.
- In this demo
- …
- In a real store
- Orders and their payments from your order system, return requests from your returns tool, and the sale's line items from Braintree. The gate reads them; it never edits them.