Inspiration

I investigate crypto fraud for a living. The pattern that never stops working on victims is the fake invoice: a lookalike vendor, a note about "updated bank details," a little urgency. The FBI's IC3 tracks business email compromise as one of the largest fraud loss categories year after year. Almost all of it is catchable, if something with context and patience reads the invoice before the money moves.

What it does

PaySentry watches a PayPal inbox of inbound invoices and screens every one through a two-stage pipeline before a cent moves:

  1. Signal stage (deterministic): 15 fraud signals with exact logic: lookalike-vendor detection by edit distance, payment-redirect language, amount anomalies against each vendor's history, threshold dodging just under approval limits, duplicate billing, urgency and secrecy phrasing, and crypto channel-switch demands. Combination rules floor the classic BEC kill-chain (lookalike vendor + "use this new account") at 85/100.
  2. AI stage (Claude): the model reviews the invoice, the fired signals, and the vendor's history, then returns a verdict with a written rationale. It can escalate anything; it can never talk the system down off a lookalike, payment-redirect, or secrecy signal. That contract is enforced in code, not just in the prompt.
  3. Policy engine: auto-pay ceiling, daily budget, new-payees-always-hold. A clean AI verdict still cannot spend past the owner's limits.

Then it acts through PayPal: safe invoices get paid, suspicious ones get held for a human, fraudulent ones get cancelled, and every decision is recorded with its full reasoning. The vendor ledger learns from every outcome, so trust is earned and anomalies have a baseline.

A detail I care about: it knows the difference between an invoice about a crypto wallet (a forensics firm billing for a wallet assessment sails through) and an invoice demanding payment to one (blocked at 75/100).

How we built it

Node.js with zero npm dependencies, straight against the PayPal Invoicing v2 REST API in the sandbox, with Claude (Anthropic API) as the verdict stage. The full signal catalog was designed first as a reviewable spec (SIGNALS.md in the repo), then implemented so a 9-invoice seed suite reproduces every behavior: two auto-pays, four holds for four different reasons, three blocks. If the AI stage is unavailable, the deterministic stage stands alone, so the system degrades to cautious instead of failing open.

Challenges

PayPal sandbox pins the invoicer email to the developer account, so simulated sender identities ride in the business name and memo (documented in the repo); production PaySentry sits on the payer side reading real sender data. Also, OAuth tokens are cached server-side for hours, which hides freshly enabled scopes until you force a fresh token.

What's next

The x402-style per-screen pricing model, inbox integrations beyond PayPal invoicing, and richer evidence exports for dispute filing.

Built With

Share this project:

Updates

Submission history