Nudge – AI-Powered Collections Agent

Inspiration

Chasing late payments is the most awkward part of freelancing. I wanted an AI to handle the awkward conversations, but giving an LLM direct access to my money is a terrible idea. I built Nudge to solve this: an AI collections agent that negotiates for you, but is strictly bound by your rules.

What It Does

  1. A freelancer inputs a messy request (e.g., "Ravi owes me $200 for copywriting, due last week").
  2. The AI creates a real PayPal invoice and generates a secure client chat link.
  3. The client opens the link and negotiates (e.g., "I need 60 days").
  4. The Magic: The AI negotiates back, but it cannot authorize a payment. It can only propose terms. My deterministic TypeScript code validates every AI proposal against the freelancer's hard rules (e.g., max 2 installments, min 30% upfront).
  5. If the client asks for something outside the rules, the AI escalates to the freelancer's dashboard for a one-tap approval.
  6. Once agreed, the client pays via PayPal, and the AG Grid dashboard updates live.

How I Built It

  • Frontend & Backend: Next.js, React, TypeScript, Tailwind CSS.
  • AI: Groq API using JSON mode for strict structured output.
  • Payments: PayPal Invoicing API and Orders API.
  • Data Grid: AG Grid for the live dashboard.
  • Deployment: Render.

Challenges I Ran Into

  • PayPal Regional Restrictions: I hit the INR_FOREIGN_CURRENCY_BLOCKED error because PayPal doesn't support domestic INR invoicing in India. I pivoted by creating a US-based sandbox buyer and switching testing to USD.
  • Partial Payments: PayPal rejected partial invoice payments for my sandbox region. I solved this by handling installments via separate Orders API calls and using the record-payment endpoint to update the invoice.
  • Model Deprecation: Mid-build, the LLM provider retired the model I was using. I had to quickly refactor my API calls to a newer model.
  • AI Safety: To prevent prompt injection, the LLM has zero authority to move money. If a user tries to inject a prompt to get a 0% upfront deal, the code catches it and forces an escalation.

What I Learned

I learned the immense value of API composition. Chaining the Invoicing API with the Orders API let me build a partial payment feature that wasn't natively supported in my region. I also learned how to build safe, state-machine-driven AI agents for financial tasks.

What's Next for Nudge

Next steps include natural language rule compilation, automated email/SMS invoice sending, and multi-tenant authentication for real-world use.

Built With

Share this project:

Updates

Submission history