Inspiration
A WooCommerce store that takes PayPal can end up with two records of the same order that do not match: PayPal shows the order as approved, while the store still shows it as pending. Working out which record to trust, and whether the two records belong to the same order at all, is a question a merchant can be left to settle by hand. We wanted a tool that shows both records side by side, says how sure it is that they are the same order, and says so plainly when the evidence is not enough.
What it does
You give Payment Incident Investigator a PayPal order ID. It reads that order and the matching WooCommerce order, shows what each system says, and says whether it can link them: confirmed, a provisional association, or unresolved. When the two systems disagree it reports what it observed and when it observed it. When the evidence is not enough it abstains. It also lists suggestions that only a person can act on, and the actions it forbids.
It changes nothing in PayPal or WooCommerce, and no route in its API executes anything. The app does create local records of each investigation.
In this submission it runs on three real PayPal sandbox orders that we recorded through a local WooCommerce store, plus three cases that we injected ourselves and label as injected on screen. Live reads are not wired in this build. The web demo link shows saved example responses from those recorded cases.
How we built it
- Engine: Node.js with no runtime dependencies. A fixed decision table of 14 rules, checked in order, picks the verdict. Every statement is backed by numbered evidence items, and the same stored inputs give the same verdict when re-run offline.
- PayPal: the PayPal Orders v2 API in the free sandbox. The reader is GET-only with an allow-list and has no write method.
- WooCommerce: the WooCommerce REST API with the PayPal Payments plugin 4.2.0, one local store, used to record the store side of the orders.
- Audit log: every investigation is written to a hash-chained log that detects edited, removed or reordered entries. It does not detect someone rewriting the whole file.
- Interface: React, Vite and TypeScript, with every case labelled as recorded or injected.
- AI: an optional layer that sends the engine's structured result to a Gemini model (gemini-3.5-flash-lite in our runs) and asks it to rephrase the result in plain English. The model does not decide the verdict or any action. Every sentence it writes must cite evidence IDs the engine produced and pass a validator, or the fixed template is shown instead. The AI layer is off unless the operator configures it.
- Process: we built it with AI coding assistants, kept a requirements and verification matrix, and wrote a claims-audit script that scans our public text for wording we have not proven.
Challenges we ran into
- Linking the two orders. In our recorded order, the store did not hold the PayPal order ID. The tool can only call that a provisional association, and it says why, rather than pretending it is a confirmed match.
- Not overclaiming. We could only observe three real sandbox orders from one setup, so we kept every public sentence tied to a piece of evidence, labelled the injected cases, and wrote the limits into the product.
- Getting a model to follow strict rules. Our validator rejected many model outputs: one used a word our avoid-list blocks, some left out evidence IDs, and some runs returned provider errors, timeouts or malformed output. In our log, only 4 of 14 attempts were accepted, and each failure fell back to the fixed template. Tightening the prompt fixed the first two problems; the provider errors we could only work around by choosing a different model.
- Keeping the AI honest. A passing validator checks citations and values. It does not prove the wording is complete. For example, the accepted AI text for order 20 leaves out the provisional-association notice, so the interface keeps that notice on screen beside it.
Accomplishments that we're proud of
- A tool whose main behaviour is saying what it can and cannot tell, including abstaining.
- A hash-chained audit log and a replay mode, so a result can be re-run from stored evidence.
- 113 automated tests, which show how the code behaves on our cases. They do not measure diagnostic accuracy.
- A claims-audit script that fails the build on phrases we have not proven, and a public evidence file that lists every AI attempt, including the failures.
What we learned
- A model that only rephrases a fixed result still needs a strict gate; most of our early model outputs failed it for small, concrete reasons.
- Recording real sandbox orders showed us how easily two systems can hold the same order without sharing an identifier.
- Writing the limits first made the product and the submission simpler to defend.
What's next for Payment Incident Investigator
- Test it with real merchants. So far no merchant has tested it, so we cannot say how often its verdicts are right or whether merchants need it.
- Run a larger, fixed evaluation of the AI layer across all cases and more than one model.
- Wire up live read mode for a sandbox store.
- Actions that fix orders, move money or capture payments are designed but not built, and are not part of this submission. If they are ever built, they would need explicit human approval for each action.
Links: code at https://github.com/sadik-tofik/Payment-Incident-Investigator and the saved-example demo at https://paypal-incident-harness.vercel.app/