Inspiration

Finance teams spend hours matching invoices to payments by hand, and most tools either guess silently or show a bare "matched / not matched". Money decisions need to be explainable. I wanted a reconciliation tool where every result comes with its reasons, and where a human, not the software, makes the final call.

What it does

PaySync AI reconciles invoices against payments and explains every decision.

  • Import payment records from CSV, with per-row validation, duplicate protection, and a report of every bad row
  • Reconcile by reference, currency and amount, and classify each invoice as matched, split-matched, underpaid, overpaid, partially paid, duplicate candidates, or missing payment
  • Find orphan payments that belong to no invoice (unknown or missing reference)
  • Show evidence (invoice amount, payments total, difference) and a recommended next action on every result
  • Explain with AI: Gemini rewrites the engine's validated facts as a short plain-English summary. It never decides or changes a result
  • Pay with PayPal: a real PayPal sandbox checkout. The server creates the order, the buyer approves, and the server captures and verifies the amount and currency before recording the payment
  • Audit trail: every reconciliation run is stored, never overwritten
  • Human approval: an invoice becomes "paid" only after a person approves a matched result

How I built it

A solo build in 10 days. The backend is a Laravel REST API on SQLite, and the frontend is a Flutter dashboard (Dashboard, Invoices, Transactions and Results screens, plus a detail view with evidence and approval).

The matching engine is deterministic. Invoices and payments are grouped by reference and currency. Pass 1 pairs exact amounts first, so a wrong-amount invoice cannot steal a payment. Pass 2 handles underpayments, overpayments and split payments (payments that sum exactly to the invoice). Anything ambiguous is flagged for manual review instead of guessed. All money is stored as integer cents, and CSV amounts are converted with string math to avoid floating-point errors.

PayPal (developer platform, free sandbox): the Orders API v2 flow runs in the Laravel backend. The amount and currency always come from my own database, never from the client. On capture, the server checks the status, amount and currency against the stored order, then records a paypal transaction that the reconciliation engine matches like any other payment. Credentials live only in the backend .env.

AI (Google Gemini API): after the rules decide, the "Explain with AI" button sends only the validated facts (status, amounts, difference, payment IDs) to Gemini. The reply is stored as text and never parsed for decisions, and if the call fails the app falls back to the rule-based explanation. I also used Claude (Anthropic) as a development assistant for design, code review and debugging.

Challenges I ran into

  • Designing matching rules that never silently guess on ambiguous cases
  • Getting money handling exact (integer cents, no floats)
  • Preventing one payment from being assigned to several invoices
  • Getting the PayPal sandbox working: my developer account verification was blocked for days, and my first checkout failed with "this seller doesn't accept payments in your currency" until I created US sandbox accounts
  • Keeping AI useful but safe: Gemini only explains validated facts, and a model name that Google retired meant the app had to fall back gracefully

Accomplishments that I'm proud of

  • A matching engine that is deterministic and auditable, with evidence and a next action on every result
  • A real end-to-end payment path: PayPal sandbox payment, server-side verification, automatic matching, and human approval
  • AI that adds value without ever being allowed to change a decision
  • A solo, working full-stack app (Laravel and Flutter) built in 10 days, with a setup anyone can run from the README

What I learned

Deterministic, auditable rules beat black-box scoring for money. Every result should carry its evidence, and a human should approve final decisions. I also learned to verify every payment response against my own records rather than trusting it, and to design AI features with a safe fallback.

What's next for PaySync AI - Smart Invoice & Payment Matching

  • Authentication and multi-user roles
  • Partial-payment tracking over time
  • Live bank feeds in place of CSV imports
  • Webhook-based PayPal confirmation
  • Automated tests for every matching outcome

Built With

Share this project:

Updates

Submission history