Inspiration
AI agents are starting to buy things on their own. When an agent checks out, the store writes the order, and the agent pays whatever that order says. A store that is dishonest, or just broken, can charge more than its listed price, add a fee it never showed, put extra units in the cart, send the money to a different PayPal account, serve checkout from a lookalike domain, or hide instructions for the AI in its product text.
Most of these checkouts look perfectly normal to an identity check. The domain is right, the merchant is on the approved list, and the PayPal account is real. The risk sits inside the order body itself. We wanted a check that reads that body before PayPal ever sees it.
What it does
Gordon PayPal Guard sits between a purchasing agent and PayPal. The store builds a PayPal Orders v2 request. Gordon scores it against four things:
- the approved vendor list (registered domain and PayPal payee)
- the vendor's own listed price
- the price the agent was shown before checkout
- what real US retailers charge for the same kind of product, from Channel3
Gordon then returns one of three decisions:
| Decision | What happens at PayPal |
|---|---|
| Allow | Gordon creates and captures the order in the PayPal sandbox |
| Escalate | Gordon creates the order with payment_source.paypal and returns PayPal's approval link, so a person decides |
| Block | No PayPal order is ever created |
The pipeline escalates at a risk score of 0.30 and blocks at 0.70:
$$\text{risk} = \max_{\text{layer}} \; s_{\text{layer}}, \qquad \text{decision} = \begin{cases} \text{allow} & \text{risk} < 0.30 \ \text{escalate} & 0.30 \le \text{risk} < 0.70 \ \text{block} & \text{risk} \ge 0.70 \end{cases}$$
Every held or refused order gets a plain-English explanation written by Claude, and holds are sent to Zapier so a person hears about them right away.
In the demo, Claude Opus 5.5 restocks an office from 11 approved vendors. Three are honest and eight are rigged. In a typical run Claude pays the three honest vendors, two orders are held for a person (a payee change and a price 40% above market), and the rest are stopped before any money moves.
How we built it
- PayPal. The PayPal Server SDK for Python handles OAuth,
create_order,get_order,capture_orderandrefund_captured_payment, all against the sandbox. Allowed orders pay with the sandbox test card. Held orders usepayment_source.paypalwithexperience_contextreturn and cancel URLs, so the approval link opens PayPal's own checkout and the order captures when the person comes back. - Claude. Claude Opus 5.5 is the purchasing agent. It works through four strict tools:
list_vendors,view_store,search_marketandcheckout. It also writes the explanation for every held or refused order, using structured output with a fixed JSON schema. It runs on Amazon Bedrock or the Anthropic API. - gordonguard. Our open-source Python SDK (zero dependencies, on PyPI) supplies the detectors: payload, catalogue, economic (listed and market price), duplicate charge and registry. We added two PayPal-specific ones: an intent check (is every item and quantity something the agent asked for?) and an order-breakdown check (do the items add up to the total, and is every fee one the store published?).
- Channel3. We search Channel3 for the real product behind each vendor's listing and snapshot the offers. Where three or more retailers sell the same product, the market price is their median. Otherwise it is the median across comparable products in a sane price band. The agent can also search Channel3 live before it buys.
- AG Grid. The console shows each decision with listed, charged and market prices side by side, and a detail panel with the explanation, the scored lines, the PayPal status and a refund button.
- Postman and OpenAPI. The gate is also a REST API (
POST /v1/orders/check) with an OpenAPI 3.1 spec. The Postman collection has one request per vendor, generated from the same store code the agent shops at, with tests on each decision. All 37 assertions pass under Newman. - Zapier. Every hold is posted to a Zapier Catch Hook with the vendor, amount, reason and the approval link.
Challenges we ran into
- Market prices that meant something. A text search for "coffee beans" also returns espresso machines, and "copy paper" returns pallets. The first market references we got included a $2,614 case of paper. We fixed it with required and excluded words, a price band, and an honest label on every price: same product, comparable products, or sample data.
- Explanations that don't overclaim. Early explanations said "5 other retailers charge $39" when the price came from sample data. The explainer now only names retailers when the data came from Channel3, and says which kind of market reference it used.
- Multi-item orders. Lines in one order first shared an idempotency key, so the second line looked like a replay. Each line now gets
invoice_id:sku. Duplicate detection is scoped per agent session, so next week's restock isn't flagged as a duplicate of this week's. - SDK errors. A bad sandbox credential raises
AuthValidationExceptioninstead ofApiException, so it slipped past our error handling until we mapped both.
What we learned
The riskiest payments in agentic commerce aren't the ones from strangers. They come from approved vendors charging the wrong amount. A domain and payee check would pass the Brightdesk overcharge, because everything about the merchant is correct. Only the price is wrong. Catching it means comparing the order body against what the store published, what the agent was shown and what the market charges, before the order reaches PayPal.
We also learned that "hold for a person" has to be a first-class decision. A payee change might be fraud or might be a vendor switching accounts. PayPal's approval flow fits that case well: the order exists, but no money moves until a person signs in and approves it.
What's next
- Real PayPal merchant onboarding, so each vendor's payee is a separate sandbox business account
- Vendor history from Elastic, so prices the business has paid before count toward the market reference
- A drop-in middleware for agent frameworks, so any agent paying with PayPal gets the check by default