Inspiration
Freelancers and small businesses lose time building invoices by hand: copying client details, typing line items, working out totals. We wanted invoicing to be as easy as describing the job in a sentence.
What it does
PayNexa turns plain English into a real PayPal invoice. You type something like "Logo design for Acme, $500, plus 2 revisions at $50 each", add the client's email, and PayNexa:
- Uses Google Gemini to extract structured invoice data (line items, quantities, prices, currency)
- Validates that data on the server with Zod before anything is sent
- Creates and sends the invoice through the PayPal Invoicing API
- Updates the invoice status automatically through PayPal webhooks
- Shows invoice history, search and filters, an analytics dashboard, and CSV export
Each user has a private account, and every invoice is scoped to its owner.
How we built it
- Frontend: React + Vite
- Backend: Node.js + Express, with MongoDB (Mongoose) for storage
- AI: Gemini parses the prompt, and its output is treated as untrusted input and strictly validated
- Payments: PayPal Invoicing API plus webhook signature verification
- Security: JWT authentication, bcrypt password hashing, Helmet, rate limiting, and a per-request
requestIdthat prevents duplicate invoices - Quality: 109 automated tests (unit tests plus Supertest route tests)
Challenges we ran into
- Making invoice creation safe to retry. We save a placeholder record before calling PayPal and mark it as failed if something breaks, so a double-click or network retry never sends two invoices.
- Not trusting AI output. Currencies, amounts and quantities are validated against a strict schema before they reach PayPal.
- Webhook security. The server verifies every PayPal webhook signature and rejects unverified events in production.
- Hardening the app. We removed a hardcoded fallback secret and scoped database lookups to the logged-in user.
What we learned
How to combine an LLM with a real payment API safely, how webhooks and idempotency work in practice, and how much a proper test suite helps when you refactor security-sensitive code.
What's next
Recurring invoices, more currencies, reminders for overdue invoices, and client-facing payment status pages.
Built With
- avascript
- bcrypt
- express.js
- google-gemini-api
- jwt
- mongodb
- mongoose
- node.js
- paypal-invoicing-api
- paypal-webhooks
- react
- vite
- zod