Inspiration
A real PayPal invoice. $600 for "ShieldPro Security Renewal". "Call within 24 hours to cancel."
A friend of mine got exactly this. The invoice was genuine. The scam was the phone number.
Because the email comes from PayPal itself, spam filters pass it and victims trust it. Panic does the rest, and the money is gone after one phone call. We built PayGuard to stop the invoice before it reaches the victim.
What it does
PayGuard is an AI guard for PayPal invoices.
- Stops scams automatically. The moment an invoice is created, PayPal fires a webhook and PayGuard scans it. A scam draft is deleted, and a sent invoice is cancelled.
- Explains in plain words. The verdict comes in simple English or Hindi, with the scam number
crossed outand a clear "do not call". - Alerts a trusted person. Register a family member or friend, and they are emailed when a risky invoice targets you. Nobody decides alone under pressure.
- Learns from reports. Every scam joins a shared scam memory, so one victim protects the next.
- Works without PayPal too. Anyone can paste a suspicious invoice into the
/checkpage and get a stamped verdict.
How we built it
| Layer | Tool | Role |
|---|---|---|
| Payments | PayPal Invoicing API, Webhooks, Sandbox | Create, send, cancel and delete invoices, with signature-verified webhooks |
| Fast checks | Rules engine | Catches phone numbers in notes, fake deadlines and pressure language |
| Memory | Elastic semantic_text index |
Matches reworded scams by meaning, including Hindi and Hinglish |
| Brain | Elastic Agent Builder and Managed LLM | The "PayGuard Judge" writes the verdict and explanation |
| Alerts | Zapier MCP and Gmail | Emails the trusted contact |
| Backend | FastAPI, SQLite, Render | Webhook handler, dashboard and hosting |
Scoring: the rules and the AI judge are combined into one score. 60 or above is a scam, 30 to 59 is suspicious, and below that is treated as safe.
Challenges we ran into
- PayPal blocked our test invoice. Sending failed with
INR_FOREIGN_CURRENCY_BLOCKED, because PayPal doesn't allow India-to-India invoices. We fixed it by using a US sandbox account as the victim. - The AI was too slow. Scoring took about 14 seconds, and the invoice status changed in the meantime. We added a fast rules-first path that stops obvious scams immediately, then lets the judge finish.
- Email on a free host. Render's free tier blocks SMTP, so we sent alerts through Zapier MCP over HTTPS instead.
- Prompt injection. Scam notes can try to instruct the AI, so we treat that as a scam signal in itself.
Accomplishments that we're proud of
- The full loop works live. The scammer's invoice is created, PayGuard stops it, and the scammer's "send" fails with "already stopped".
- The trusted-contact alert reaches a real inbox.
- It runs entirely on free-tier tools, with no OpenAI key.
- It's built for panicked, non-technical people, with large text, Hindi support and plain language.
What we learned
- Scams work through trust and urgency, so the fix has to be fast and explain itself in human terms.
- Rules + semantic memory + an LLM judge beats any one of them alone.
- Webhooks, retries and stale-state handling matter as much as the AI itself.
What's next for PayGuard
- [x] Scam detection, auto-stop and plain-language verdicts
- [x] Trusted-contact email alerts
- [ ] Verified trusted contacts who confirm before receiving alerts
- [ ] A dispute path for invoices that were already paid, using PayPal's Disputes API
- [ ] More languages beyond English and Hindi
Built With
- css
- elastic
- elastic-agent-builder
- elastic-managed-llm
- elasticsearch
- fastapi
- github
- gmail
- html
- httpx
- javascript
- mcp
- paypal
- paypal-invoicing-api
- paypal-sandbox
- paypal-webhooks
- python
- render
- semantic-search
- sqlite
- zapier
- zapier-mcp