Inspiration
A few months ago I watched a small online seller find out about a recall the worst possible way: from a customer. The product had been recalled weeks earlier. The notice was public the whole time. It just never reached her. That stuck with me. I work in retail supply chain, where big retailers have whole teams watching recalls, tracing batches, and pulling stock within hours. A small seller has none of that. She has a PayPal account, a list of orders, and no time to read the FDA enforcement feed every morning, decode its lot codes and dates, and check them against every order she has ever shipped. So she doesn’t. Nobody in her position does. And the quiet worry that something she sold might be hurting someone never really goes away. I started with the hardest case I could think of: an online food seller. Food recalls are frequent, they hinge on exact lots and dates, and the risk to customers is real. If an agent can get recalls right there, precisely and safely, it can get them right anywhere.
What it does
Pullback is a proactive recall agent for small sellers who take payments through PayPal. Most recall tools wait for a customer to complain. Pullback moves first: it finds the problem, finds the people affected, and makes them whole before anyone has to ask.
It reads every FDA recall, every day. Each morning, Pullback reads new records from the official openFDA food enforcement feed. An FDA recall is not a simple alert. It is a dense record with a recalling firm, a product description, a reason, lot codes, best-by dates and an official classification. Pullback extracts all of it: every barcode, lot and date range, plus the hazard type, such as an undeclared allergen, a pathogen or foreign material.
Silence is the default. Most days nothing matches, and Pullback says nothing. It only interrupts the owner when a recall truly concerns something the store sold.
It matches on hard facts first. Barcode, brand, lot and best-by date are checked before anything else. AI is used only for the messy cases, like a recall that says “Organic Trail Mix 12oz” when the listing says “Trail Mix Organic, 340g.” Every match comes with its evidence: the recall line beside the store’s product, with the matching fields highlighted.
It knows when not to act. A recall from the same brand but a different product or batch is logged with a one-line reason, such as “Same brand, different lot range” or “Different product size, not carried by this store.” No false alarm, and the owner can see exactly what was checked and why it was set aside.
It narrows to the exact orders. Recalls cover specific lots and dates, so Pullback does too. Instead of “everyone who bought trail mix,” it reports 14 of 211 orders: the ones shipped from the recalled lots.
Severity follows the FDA, not a guess. The response depends on the official recall class. Class I, a real risk of serious harm, is urgent and gets a refund batch ready immediately. Class III, unlikely to cause harm, is logged without interrupting the owner. Allergen and pathogen hazards raise the urgency. The AI explains the hazard in plain words, but the official class decides what happens.
One brief, one click, and PayPal does the work. The owner gets a single brief: the recall, the evidence, the affected customers, and the total refund. A preview shows every refund before any money moves. On approval, Pullback: refunds each affected order through PayPal, against the original payment; flags the product listing so it stops selling; sends each customer a clear notice saying what the recall instructs: stop using it, discard it or return it, and that their refund is on its way. Every order in the store is tied to a real PayPal payment, so refunds go straight back where the money came from. The seller never leaves the PayPal ecosystem or handles customer payment details.
It keeps watching after the first response. Recalls often grow. If the FDA expands a recall to new lots, Pullback re-reads it, re-checks past orders, and flags only the newly affected customers, without touching anyone already refunded.
It is built to be trusted with money. Nothing is paid without the owner’s approval. Every refund carries an idempotency key, so a retry can never pay twice. Refunds are capped and can never exceed what the customer originally paid. Uncertain matches go to a human review list, never to a refund. Every decision, refund and message is recorded in an audit log.
What this looks like for a real seller. Meera runs a small online snack shop on PayPal. In our demo, the FDA recalls one batch of a trail mix she sells. Without Pullback, she would hear about it weeks later through complaints and disputes. With Pullback, the recall is read the next morning, matched to her product, and narrowed to 14 of her 211 orders. She approves about $340 in refunds with one click, and all 14 customers are warned and refunded in under a minute.
How we built it
Pullback is built around one principle: an agent that moves money has to be precise first and fast second. Every layer is designed so that the cheap, certain checks run first, AI handles only what rules can’t, and no money moves without a human decision.
1. Proactive by design: a daily recall pipeline A scheduled job runs every morning without anyone asking. It pulls new records from the openFDA food enforcement API and fingerprints each one with a content hash. New recalls are processed, unchanged ones are skipped, and a changed fingerprint on a known recall is treated as an expansion. Pullback never re-does work it has already done, and it never waits for a customer to complain.
2. Reading the recall: rules first, AI second FDA records bury the key facts in free text. Parsing runs in two steps: Deterministic extraction: pattern matching pulls out exact identifiers such as barcodes, lot codes and dates. AI extraction with Gemini: a fast Gemini model reads the product description, lot information and reason for recall, and returns structured data: brands, product names, sizes, lots, date ranges and hazard type.
When the two disagree on an exact identifier, the deterministic result wins. AI fills the gaps but never overrides hard facts.
3. Matching: identifier-first, AI only for messy cases Each recall is checked against the store’s catalog in order of certainty: exact barcode, then brand with a normalized name and size (including unit conversions like 12 oz to 340 g), then lot and best-by overlap. Only when these give a partial signal does a stronger Gemini model compare the recall and product field by field. Because most recalls are ruled out by cheap checks, the AI runs rarely, which keeps the agent fast, low-cost and predictable.
Every decision is stored with its evidence and a one-line reason, whether it’s a match, a near-miss or a “needs review.”
4. Narrowing: from product to exact orders Each order in the store records the batch it shipped from. Pullback compares those batches to the recall’s lots and date ranges and selects only the affected orders, recording the rule that selected each one. An order with no batch information is never guessed at; it goes to human review.
5. Severity from the source The response follows the FDA’s official classification, with allergen and pathogen hazards raising urgency. Gemini writes the plain-language hazard explanation, but fixed rules decide what happens. The agent’s behavior on the most important decision is fully predictable.
6. Structured, validated AI Every Gemini call returns structured JSON that is validated against a strict schema before the app uses it. If a response is invalid, the agent retries once with the error, and if it still fails, the item goes to human review instead of being acted on. Every AI call is logged with its prompt version and model.
7. Money movement built like a payments system Approved actions go through an executor modeled on how payment systems handle money:
Outbox pattern: every refund is recorded as planned before PayPal is called, and updated after, so nothing is lost if a call fails midway.
Idempotency : each refund carries a unique key sent to PayPal, so a retry returns the original result instead of refunding twice.
Caps and guards : per-order and per-batch limits, and a hard rule that a refund can never exceed what was captured minus what was already refunded. If a cap would be breached, the batch stops and goes back to the owner.
Reconciliation: after execution, each refund is checked against PayPal to confirm its final state.
8. Native to PayPal Every order in the store is tied to a real PayPal payment through the Orders API, and every refund goes back against that original capture through PayPal’s Refunds API. Because PayPal has no “list all orders” call and its transaction search can lag, Pullback keeps its own order records linked to PayPal payment IDs, so it always knows exactly which payment to refund.
9. Expansion without double work When a known recall changes, Pullback compares the new lots and dates against the previous version and narrows only on what’s new. Customers who were already refunded are never touched again.
10. A full audit trail Every agent decision, owner action, PayPal call and customer notice is written to an append-only log. The owner can see exactly what was checked, what was refunded and wh
Challenges we ran into
FDA recall records are messy. Lot codes, dates and product names are written in free text and in many formats. We combined pattern matching for exact identifiers with Gemini extraction for the rest, and made the hard identifiers always win.
A wrong refund is worse than a missed match. Getting the matcher to be precise, not just clever, took the most tuning. Anything uncertain now goes to a human review list instead of being acted on.
Keeping the AI predictable. Free-form AI output isn’t safe to act on with money. Every Gemini response had to be structured, validated, and routed to review if it failed.
PayPal has no “list all orders” call, and transaction search can lag. We keep our own order records, each linked to a real PayPal payment ID, so every refund goes back to the right payment.
Sandbox payments can’t be backdated. Real sandbox payments are all dated the day they’re created, so the two-month sales history in the demo store is simulated and clearly labeled.
Making refunds safe to retry. A network failure mid-refund could mean paying twice. Idempotency keys, an outbox record before every call, and refund caps solved it.
Accomplishments that we're proud of
A working end-to-end loop. A real FDA recall is read, matched, narrowed to the exact orders, approved, and refunded through PayPal, live in the sandbox.
Precision that earns trust. Pullback doesn’t flag “everyone who bought this.” It finds the exact 14 of 211 orders and shows the evidence for each one.
An agent that knows when not to act. Near-misses are set aside with a clear reason, so the owner only hears about what really matters.
Proactive, not reactive. Customers are warned and refunded before anyone has to complain or open a dispute.
AI that’s safe to trust with money. Owner approval, idempotent refunds, caps, validated AI output and a full audit trail. Nothing moves that shouldn’t.
Turning a compliance problem into one click. Hours of manual tracing became a single brief and a single approval.
What we learned
Precision is the product. An alert is easy to build. Being right about the exact 14 orders is what makes an owner trust an agent with real money.
AI works best with rules around it. Gemini is excellent at reading messy recall text, but hard facts and fixed rules should decide when money moves.
Knowing when not to act matters as much as acting. A clear reason for every skipped recall builds more trust than a flood of alerts.
Payments need engineering discipline. Idempotency, caps and an audit trail aren’t extras; they’re what make an agentic payment flow safe.
Small sellers face big-company problems without big-company tools. The most useful thing AI can do here is give them the same protection large retailers already have.
What's next for Pullback
More recall sources. Expand beyond FDA food recalls to consumer products (CPSC), USDA and recall agencies in other countries.
Owner-set rules for autonomy. Let sellers approve refunds automatically within limits they set, for example “auto-refund serious recalls under $20.”
A reviewer agent. A second agent that independently checks every refund batch against the evidence before it reaches the owner. Dispute handling. Automatically resolve PayPal disputes on affected orders with the recall evidence attached.
Supplier reimbursement. File claims to suppliers through PayPal invoicing so sellers recover the cost of refunds.
Label and photo reading. Use Gemini’s vision to read lot codes and best-by dates from product photos when listings lack them.
Customer recall pages and multilingual notices, so every affected customer knows what to do in their own language.
Built With
- drizzle-orm
- gemini
- google-genai
- next.js
- node.js
- openfda
- paypal
- paypal-orders-api
- paypal-refunds-api
- postgresql
- react
- tailwindcss
- typescript
- zod