Inspiration
Small businesses do the work first and get paid later. An electrician fixes a socket on Monday, types the invoice at night, and then waits two or four weeks. If the customer is late, the owner often says nothing, because a hard letter could lose a good customer. Meanwhile the bank balance looks fine, although part of it is VAT that is already owed, even on invoices nobody has paid yet.
The numbers fit this. In a study across 11 European countries, 24% of invoices were paid late or not at all, and 48% of respondents reported profit losses (EOS, 2026). In Germany, all businesses must be able to receive e-invoices since 2025, and sending them becomes mandatory by 2028 (IHK Frankfurt). Most invoice tools stop when the invoice is sent. PaidLoop starts there: it writes the legal invoice, creates the PayPal request, follows it up kindly, and agrees a fair plan when a customer cannot pay.
The people in our demo, Max the electrician and his customers, are made-up examples. No real business has tested PaidLoop yet, and we say so under "What's next".
What it does
- Capture: a typed note, PDF, photo or scan becomes an invoice draft, also from handwriting. A local vision model reads photos, and the photo is shown next to the fields so the owner can compare. A sideways photo (WhatsApp removes the turn information) can be turned and read again. Anything not found in the note is marked for the owner.
- German and English: every screen, message and legal check follows a language switch. Invoices, reminders and the customer page use the customer's language.
- Legal check: fixed rules check required fields and VAT against German law, and explain the fix in plain words.
- Issue: one click creates a ZUGFeRD e-invoice, validated with the official EN 16931 rules, plus a PayPal request, link and QR code.
- Follow up: an agent picks the next step for each open invoice and explains why. Reliable customers get more time. Serious steps wait for the owner.
- Payment plan chat: a customer can say "I lost a big client". The offer comes from the owner's limits, enforced in code. The customer accepts, and PayPal creates the requests.
- Real life: if a customer says the work is wrong, reminders pause. If they say "I already paid", PayPal is checked. Bank transfers can be recorded. Cancelling creates a legal credit note.
- The truth about cash: the dashboard shows what you can really spend after VAT, including VAT already due on unpaid invoices.
- Ready for real owners: each business connects its own PayPal sandbox app and local AI in Settings > Connections. Keys are tested before saving, the secret is stored encrypted, and only this computer can use the owner screens.
How we built it
- PayPal: Invoicing API v2 in the sandbox: create, send, QR code, reminders, record payment, cancel, search, and webhook verification. Payment status also works by polling, so no public server is needed.
- AI: Ollama with free models running locally: Qwen 2.5 3B for text, and Qwen3-VL 4B Instruct for photos of handwritten notes. No customer data leaves the computer and nothing costs money.
- Safety: the AI only proposes. A policy gate in code decides. Amounts, dates and legal text always come from code.
- E-invoice: a ZUGFeRD PDF with the XML inside, checked by Saxon-JS running the official EU rule file.
- App: one language, TypeScript: NestJS server, SQLite with indexes, React screens in English and German. Double-entry ledger and a hash-chained audit trail.
- Screens: built to a written UI rulebook, with one set of shared parts, the Inter font, Lucide icons, light and dark themes, and phone layouts. Machines check the rules: contrast in both themes, accessibility lint, axe on 169 screen views at 5 widths, size limits, and 30 end-to-end owner flows. GitHub CI runs all of them, plus 348 server tests.
- Help: the code was written with Claude Code, under my direction and with my review.
Challenges we ran into
- The small free model understood customers well, but it misread numbers: 3.5 hours became 1, it invented a date, and an instruction hidden in a note changed a price. So fixed rules now read clear notes first, and every AI number is checked against the note.
- Our 2 GB graphics card made the AI slower than the processor alone. Switching took it from 2 to about 8 tokens a second.
- The official e-invoice rules caught real bugs, such as small businesses that only have a tax number.
- We first built the server in Python, then moved it to NestJS in one go. The same 23 routes gave the same answers, and the real sandbox story still passed. It also got about 5 times faster.
- Tests found concurrency bugs: two invoices taking one number, a screen reading before the save finished, and a false alarm in the audit trail.
- Handwriting: the free text reader turned "3 Std à 55 €" into nothing and "18,90" into "18,40". A local vision model reads our test notes correctly, but on a laptop it needed photos made smaller first (from 4 minutes to about 2), only one model in memory at a time (the laptop ran out of memory), and a model that answers directly instead of "thinking" for minutes. A real note sent by WhatsApp arrived sideways, so we added Turn left, Turn right and Read again.
- The PayPal sandbox never sends email to real addresses, so we did not see the invoice mail on a real inbox. Test customers pay through the pay link instead.
Accomplishments that we're proud of
- The full story runs against the real PayPal sandbox with a German test account, including a real payment that PaidLoop recorded by itself.
- Every issued e-invoice must pass the official EN 16931 rules first.
- A customer can't talk the agent out of its limits, and tests prove it.
- Every screen passes automatic accessibility checks at 5 widths, in light and dark, in English and German.
- It works with free tools only, on one laptop, with no data sent to an AI company.
What we learned
- Let the AI propose and let code decide. Money amounts, dates and legal text are too important to trust to a small model, and code limits make the agent safe even when a customer tries to trick it.
- Test the AI on real data, early. Our own tests of the free model and a real handwritten note showed mistakes that no demo would have shown.
- Machine checks find what the eye misses: the official e-invoice rules, the accessibility checks and the concurrency tests each caught real bugs.
- Hardware is a design limit. A 16 GB laptop forced smaller photos, one model at a time, and a fallback that always works.
- Honest limits build trust: we mark every number read from a photo, show the photo next to the fields, and say plainly what has not been tested with real businesses yet.
What's next for PaidLoop
- Testing with real small businesses.
- A review of the German wording and legal rules by a tax adviser.
- Customers abroad: EU reverse charge, customers outside the EU, and other currencies. Today PaidLoop handles German VAT in euros only.
- XRechnung format and bank connections.
Testing instructions
No account or key is needed to start. The README has a "For judges: try it in 5 minutes" section. Clone the repo, run npm install --ignore-scripts and npm run build in frontend, then npm install --ignore-scripts and npm start in backend, open http://localhost:8000 and click Reset demo. Without keys, the app uses a clearly marked PayPal simulator and fixed rules, so every step works at once. To use your own free PayPal sandbox app, paste its client ID and secret in Settings > Connections. All data is made up and no real money moves.
Code: https://github.com/diomr9411-svg/paidloop (MIT licence)
Built With
- api
- en16931
- inter
- invoicing
- lucide
- nestjs
- node.js
- ollama
- paypal
- qwen
- react
- saxon-js
- sqlite
- tesseract.js
- typescript
- vite
- zugferd
