I'm building PurseString, an open-source MCP server that lets AI agents spend money safely. A lot of it got built this week, because I'm in the middle of the PayPal AI Hackathon and building in public every day.
Today I want to share something more technical. When you let an agent touch money, the scary bugs aren't the clever ones. They're the boring ones that every payments engineer already knows about, except now nobody's watching while they happen.
Here are four of them, and what I did about each.
Bug 1: The retry that pays twice ๐
This is the one that started the whole project. A checkout page hung for a few seconds. My agent decided the payment had failed and did the sensible thing: it tried again. Both charges went through.
Agents retry by design. That's normally a good thing. With money it's a disaster.
The fix: make the purchase idempotent, not just the API call.โฆ