Inspiration

I work in integration and finance automation at Boomi. Every finance team I talk to has the same complaint: chasing unpaid invoices is a nightmare. One senior accountant told me she spends 3 hours a day deciding who gets a discount, who gets a payment plan, who needs urgent follow-up. That's 80% of her time doing manual work that a computer could do in seconds.

When I saw PayPal's hackathon theme "Build What's Next," it clicked. What if AI could make those decisions? What if we could pull invoice data, run it through AI, and auto-generate payment links instantly?

That's the idea.


What it does

The system automates invoice collections from start to finish. Pull unpaid invoices from Salesforce. Run them through Google Gemini AI. AI analyzes days overdue, invoice amount, and payment history. Then it recommends a strategy for each customer: discount percentage, payment plan (split vs full), priority level, follow-up action.

Finally, PayPal REST API generates live payment links. Everything happens in seconds. Finance team gets a structured output with AI recommendations and ready-to-send payment links.

We tested with 3 real invoices ranging from 25K to 75K dollars. Each got a unique recommendation and a live PayPal link.


How we built it

The architecture is straightforward:

  • Salesforce pulls unpaid invoices
  • Google Gemini AI analyzes them
  • PayPal generates payment links
  • Python orchestrates everything

The flow:

  1. Fetch unpaid invoices from Salesforce
  2. Send to Gemini AI with days overdue, amount, customer profile
  3. AI recommends priority, discount percentage, payment plan
  4. PayPal REST API generates live payment links
  5. Output clean JSON for automation

Real APIs throughout. No mocking. Production-ready from day one.

Tech stack: Python, Salesforce API, Google Gemini, PayPal Sandbox API, GitHub.


Challenges we ran into

Salesforce auth nightmare. Trial accounts live on sandbox.salesforce.com but the Python library defaults to production. Spent an hour debugging until I added the domain parameter. Now I know to check endpoints immediately.

PayPal currency mismatch. Generated links for USD but my sandbox account was set to INR. PayPal rejected it. Workaround: showed generated links in the demo (proof it works) without completing the transaction. Sometimes good enough beats perfect.

GitHub secret scanning. Accidentally committed API keys. Had to clean git history and add .env to .gitignore. Lesson learned hard.

Time management. Spent way too long debugging Salesforce API instead of focusing on the core demo. Eventually realized: mock Salesforce data still proves the architecture works. Real PayPal and real AI are the stars. Pivoted and that saved the project.


Accomplishments that we're proud of

We shipped working code. AI analysis runs in real-time. PayPal links generate instantly. Tested with three invoices and all three got unique recommendations and live payment links.

The code is clean and open on GitHub. Anyone can clone, add their own API keys, and run it.

We proved the concept in 7 days with real APIs, not toy code. That matters.


What we learned

Real APIs beat mocks. Using actual PayPal Sandbox forced us to handle real auth, real error codes, real currency constraints from day one. That's how you build production code.

AI is pattern matching. Gemini doesn't understand finance. It sees (days overdue + amount) and outputs (priority + discount). That simplicity is powerful.

Service separation matters. Each piece (Agent, PayPal, Salesforce) is independent. Swapping components later is straightforward.

In hackathons, working demo beats perfect integration. Sometimes you have to pivot and accept "good enough" to ship on time.


What's next for Smart Invoice Payment Orchestration Agent

Deploy to Google Cloud Run so it runs continuously. Add Slack notifications when payment links are generated. Integrate with accounting software for auto-reconciliation so payments sync back to Salesforce automatically.

Add more AI logic: predict payment probability based on customer history, auto-adjust discounts based on cash flow patterns, trigger dunning workflows when customers don't pay by certain dates.

Test with real finance teams to see where the AI recommendations need tuning. Build a dashboard to track which payment strategies work best for different customer segments.

Scale it from 3 invoices to 3000. Make it the standard way finance teams chase payments.

Built With

Share this project:

Updates

Submission history