How LeashPay checks every purchase
The AI agent does the shopping. Code holds the rules. You hold the approval. Here is the path a single purchase takes.
You
ask for something
AI agent
searches, proposes
Policy engine
checks every rule
PayPal
order with checked total
You
approve and pay
Follow one purchase from chat to receipt
The $30 headphones in the demo shop, with a $50 budget. Scroll, and the window follows along.
- 01
You ask for something
Plain words in the shop chat. The agent gets your message and your spending rules, nothing else.
- 02
The agent searches and proposes
It searches the catalog, compares what fits and proposes a cart with propose_cart. It can't add anything to your cart directly.
- 03
Code checks every rule
The policy engine prices the cart from the database and runs all eight rules. One failure blocks the cart and names the rule.
- 04
You approve on PayPal
The server checks the cart again, creates a PayPal Sandbox order for the checked total and sends you to approve it.
- 05
The payment is verified
On your way back, capture checks that PayPal took exactly the saved amount and currency before the order is marked paid.
The agent's four tools
The agent works only through these. None of them can pay, change your rules or see payment details.
- get_spending_rules
Reads your budget, allowed categories and item limit, so the agent can plan a cart that fits.
Returns: Budget, categories, item limit
- search_catalog
Finds products by name, category or description, with an optional price ceiling.
Returns: Matching products with prices
- compare_products
Lines up two or more products by price, rating and stock when you want to choose.
Returns: Products sorted by price
- propose_cart
Sends a cart to the policy engine. An allowed cart lands in your cart; a blocked one comes back with the rule it broke.
Returns: Allowed with total, or the block reason
Three checks between the agent and your money
Totals always come from the shop's database. The agent, the browser and the chat never set a price.
- 01
When the agent proposes
propose_cart runs the policy engine before anything reaches your cart. The agent hears the exact reason when it is blocked.
- 02
When you press Pay with PayPal
The server checks the cart again and prices it from the database. Amounts sent by the browser are ignored.
- 03
When PayPal sends you back
Capture checks PayPal took exactly the saved total and currency. A mismatch marks the order for review.
Try to break the budget
Ask the agent to ignore your $50 limit and buy the $500 monitor. Watch the rule it hits.