Home / Writing / The Rail Does Not Enforce Your Envelope AI agents · Payments

The Rail Does Not Enforce Your Envelope

November 12, 2026

AI agents are starting to buy things. The usual way to let one buy something is to hand it a payment credential, a card number or an API key with spending power, and hope it stays inside the lines you described in a prompt. Hope is not a control. A prompt is a request. A credential is a capability, and capabilities do not care about requests.

So I put the control somewhere else. Scoped Purchase Tokens is a small service I built for the PayPal AI Hackathon, and it starts from a blunt rule: never hand an agent a payment credential. Hand it a token that can only do the one job a human approved.

The design

A human approves an exact order or a budget envelope: this payee, up to this amount, once. The service mints a single-use token that carries exactly that scope. The agent holds the token, never a card. When the agent attempts a capture, the service checks the attempt against the token's scope before anything reaches PayPal. Wrong payee, amount over the ceiling, token already spent: the capture does not happen. The scope is enforced by the service at capture time, not by the model's good behavior.

The evidence trail matters as much as the gate. Every step lands in a hash-chained transcript, so the record of what was approved, attempted, refused, and captured cannot be quietly edited afterward. PayPal's webhooks for the order lifecycle arrived signature-verified, 11 or more events across the test runs, so the states in the transcript are PayPal's states, not my service's guesses.

The demo

The demo is the part everyone asks about, so here it is plainly. The agent is told to book a flight. The product reviews it reads along the way are poisoned: planted text steering it toward a $900 television from a different seller. The agent tries. From the model's point of view it is an honest try. The injected text did its job.

The service refuses the capture, with the reason payee_out_of_scope, and the refusal costs nothing: a failed attempt does not burn the token. Then the same token does its one legitimate job. The $340 SkyAir flight captures, the transcript verifies clean, and the token is spent. One approval, one purchase, nothing else possible. That is the whole argument in one run. The persuasion worked on the model and failed against the scope, because the scope was never the model's to interpret.

The finding

Everything in this project ran against PayPal's sandbox: test money, test accounts, no real funds anywhere near it. I want that said once, clearly, because the finding is about behavior, and the sandbox implements the same documented rules as the live rail.

While testing against a $400 authorization, I found the thing this post is named for. A capture of $340 completed, as expected. Then a capture of $401 completed. Then a capture of $460 completed, against the same $400 the human had authorized. $460 is not a random overage. It is exactly PayPal's documented overcapture tolerance: a capture can total up to 115 percent of the authorized amount, or the authorized amount plus $75, whichever is less. On a $400 authorization, that cap lands at $460.

Two boundaries, stated honestly. A $1 recapture after a final capture was rejected, so the tolerance does not reopen a spent authorization. And whether $461 or more would also have completed, I did not test. I am saying so plainly rather than implying the ceiling is proven from my side. The documentation says $460 is the cap. My captures say the tolerance is real, and reachable by an agent holding a token that was supposed to stop at $400.

The conclusion is not really about PayPal. The authorization was never a ceiling. Nothing at the rail treated $400 as a hard stop, because at the rail it is not one. It is a reference number with a documented tolerance around it. The only thing that ever enforced my $400 was my own service's pre-call check, the scope test that runs before a capture request is allowed to exist. Remove that check, and an agent's budget is a suggestion the rail will happily exceed.

What this means

Anyone building payments for agents should take the general shape of this seriously. Your budget logic cannot live in the prompt, and it cannot live in the authorization amount. It has to live in code you control, on your side of the rail, checking every attempt before the attempt is made. The model will be persuaded by something eventually. The demo above is not exotic; it is a product review. When that day comes, the question is whether anything other than the model gets a vote.

The project is public, and it was submitted to the PayPal AI Hackathon on November 12, 2026. The demo video is under two minutes. The repo is MIT licensed, with the code, the evidence, and the run instructions.

Judging will say what it says. The finding stands either way. The rail does not enforce your envelope. You do, or nobody does.

Working on the same problem? hello@kbird.ai