TL;DR: Manual commercial loan payoffs often take 35–50 minutes each. I built PayoffAgent—a production SaaS that automates payoff calculations for lenders—in 7 days using Claude and Cursor. Typical run time after extraction: minutes, not hours; accuracy 95%+. Cost per calculation about $0.66. Below: why the problem is expensive, then a day-by-day build log if you want the technical detail.
The Problem: 35-50 Minutes of Manual Work
Commercial lenders waste an absurd amount of time on loan payoff calculations. Here's what the manual process looks like:
- Download the PDF from the previous lender's portal (5 minutes of navigation)
- Extract key data manually: loan amount, interest rate, payment schedule, origination date
- Open Excel and build a custom amortization schedule
- Account for edge cases: different day count conventions (30/360 vs. Actual/365), prepayment penalties, late fees, variable rates
- Calculate the exact payoff amount for a specific date
- Double-check everything because mistakes cost thousands of dollars
Total time: 35-50 minutes per payoff. For lenders processing 20+ payoffs per month, that's 12-17 hours of manual work. At a $50/hour labor cost, that's $7,200 to $10,200 per year per employee just on this one task.
And that's not counting the error rate. Miss a prepayment penalty clause? You just cost your client thousands. Use the wrong day count convention? The payoff amount is wrong, and now you're reworking it.
Why I Could Build This in 7 Days
Let me be clear: this isn't a humble brag. Seven days to build production-ready SaaS would have beenimpossible two years ago. Here's what changed:
- Claude Sonnet 4 can actually understand complex financial documents and write production-quality code. Previous AI models would hallucinate formulas or miss edge cases.
- Cursor IDE makes working with AI seamless—no copy-paste, no context-switching. Just describe what you want, and it writes the code in-place.
- Modern SaaS stack (Next.js, Supabase, Vercel) means no DevOps, no server management, no infrastructure headaches.
- 20+ years of domain expertise in commercial lending. I knew exactly what edge cases to test for and what calculations had to be perfect.
The combination of AI coding tools + deep domain knowledge + modern infrastructure is what makes this possible. Take away any one piece, and it would have taken months instead of days.
Day-by-Day Breakdown
Day 1: Architecture and Database Design
Started with the data model. What needs to be stored? What relationships matter?
I prompted Claude: "Design a PostgreSQL schema for a SaaS that processes loan payoff calculations. Need to store: users, uploaded PDFs, extracted loan data, calculation results, payment history. Multi-tenant with row-level security."
Claude generated a solid schema in about 30 seconds:
userstable with authorganizationsfor multi-tenant supportloan_documentsto store uploaded PDFsextracted_loan_datawith all the fields Claude would extractpayoff_calculationsto store resultspayment_schedulesfor amortization tracking
I reviewed it, made a few tweaks (added indexes, tightened some constraints), and deployed to Supabase. Row-level security policies took another hour.
Time spent: 4 hours
Day 2: PDF Processing with Claude API
This is where the magic happens. Traditional PDF parsing is a nightmare—tables that aren't really tables, text that flows weird, scanned images instead of searchable text.
Claude's vision API can actually understand financial documents. I built an API route that:
- Accepts a PDF upload
- Converts PDF pages to images (using
pdf-lib) - Sends images to Claude with a detailed prompt about what data to extract
- Returns structured JSON with loan terms, payment schedule, special conditions
The prompt engineering took most of the day. I had to be very specific about date formats, handling missing data, interpreting prepayment penalty clauses, etc.
Final prompt was about 800 words with 15+ example scenarios. But once dialed in, accuracy was 95%+.
Time spent: 8 hours
Day 3: Calculation Engine
Now the hard part: making the math actually work.
Commercial loan calculations have endless edge cases:
- Day count conventions: 30/360 (treats every month as 30 days) vs. Actual/365 (uses real calendar days)
- Prepayment penalties: sometimes a percentage of remaining balance, sometimes a fixed amount, sometimes tiered based on when you pay off
- Variable rates: need to account for rate changes mid-term
- Irregular payments: what if they missed payments or paid extra?
I built a calculation engine with separate functions for each concern:
// Day count calculations
function calculateDayCount(startDate: Date, endDate: Date, convention: string): number {
if (convention === '30/360') {
return calculate30_360(startDate, endDate);
} else if (convention === 'Actual/365') {
return calculateActual365(startDate, endDate);
}
// ... more conventions
}
// Prepayment penalty logic
function calculatePrepaymentPenalty(
remainingBalance: number,
penaltyType: string,
penaltyRate: number,
loanAge: number
): number {
// Complex business logic here
}
// Main payoff calculator
function calculatePayoff(loanData: LoanData, payoffDate: Date): PayoffResult {
// Builds amortization schedule
// Applies all edge cases
// Returns exact payoff amount
}Claude wrote the initial versions, but I had to debug and refine extensively. The 30/360 calculation, in particular, had subtle bugs that only showed up with certain date combinations.
Time spent: 10 hours
Day 4: User Interface and Auth
Used Next.js App Router with Server Components. Supabase handles auth out of the box.
Key screens:
- Upload page: Drag-and-drop PDF, processes with Claude, shows extracted data
- Review page: User can verify/edit extracted data before calculation
- Results page: Shows payoff amount, amortization schedule, downloadable report
- Dashboard: List of all processed payoffs with search/filter
Cursor + Tailwind makes UI development incredibly fast. I'd describe what I wanted ("Create a drag-and-drop upload area with progress indicator"), and it would generate production-ready components.
Time spent: 7 hours
Day 5: Testing and Edge Cases
This is where domain expertise matters. I collected 30+ real loan documents from my equipment finance network and ran them all through the system.
Found bugs:
- Claude occasionally misread dates in certain PDF formats
- Prepayment penalty calculation was off for tiered structures
- Day count convention wasn't being applied consistently
- Variable rate loans needed special handling
Spent the day fixing these issues and adding validation rules to catch extraction errors.
Time spent: 9 hours
Day 6: Payment Integration and Deployment
Integrated Stripe for payments. Pricing model:
- Pay-per-calculation: $15 per payoff
- Monthly plan: $399/month for 50 calculations
- Enterprise: Custom pricing for high-volume
Deployed to Vercel. The whole deployment took 10 minutes. No server configuration, no DNS headaches, just push to Git and it's live.
Time spent: 5 hours
Day 7: Documentation and Polish
Created:
- User documentation (how to upload, interpret results)
- API documentation (for potential integrations)
- FAQ page addressing common questions
- Demo video showing the workflow
Also added polish: loading states, error messages, email notifications when calculations complete.
Time spent: 6 hours
Total active development time: 49 hours over 7 days
The Technical Stack
- Frontend: Next.js 14 (App Router), TypeScript, Tailwind CSS
- Backend: Next.js API routes, Supabase (PostgreSQL + Auth)
- AI: Claude Sonnet 4 API for PDF extraction
- Payments: Stripe
- Hosting: Vercel (frontend), Supabase (database)
- File Storage: Supabase Storage
- Development: Cursor IDE with Claude integration
Real Costs and Economics
Development costs:
- Cursor Pro subscription: $20/month
- Claude API credits: ~$30 for testing/development
- Total to build: $50
Per-calculation costs:
- Claude API (PDF processing): $0.45
- Database/storage: $0.15
- Hosting/bandwidth: $0.06
- Total per payoff: $0.66
Pricing:
- Charge: $15 per payoff
- Gross margin: $14.34 (95.6%)
For context, if I had hired developers to build this:
- Senior engineer: $150/hour × 200 hours = $30,000
- Timeline: 4-6 weeks minimum
I built it myself in 7 days for $50. That's a 600x cost advantage.
What AI Did Well vs. What I Had to Fix
What Claude/Cursor did exceptionally well:
- Boilerplate code: API routes, database queries, form handling—all generated perfectly
- UI components: Beautiful, accessible components with proper TypeScript types
- PDF understanding: Claude's vision API is shockingly good at interpreting financial documents
- Documentation: Generated clear, comprehensive docs from code comments
What I had to fix or write myself:
- Financial calculation edge cases: AI doesn't understand nuanced business rules without extensive prompting
- Date math bugs: Off-by-one errors in day count calculations
- Error handling: AI tends to be optimistic; I had to add defensive checks everywhere
- Performance optimization: AI-generated code isn't always efficient; I refactored hot paths
Bottom line: AI writes 80% of the code perfectly. The other 20% requires domain expertise and debugging skills. But 80% automation is still transformative.
Lessons Learned
1. Domain expertise is your unfair advantage
Anyone can ask AI to "build a SaaS app." Very few people know exactly which edge cases matter in commercial lending. That knowledge is what made this work.
2. Prompt engineering is actual engineering
Getting Claude to extract loan data correctly took 20+ iterations of the prompt. Each word mattered. This is a real skill.
3. Start with the hardest problem first
I validated PDF extraction on Day 2 before building the UI. If Claude couldn't understand the documents accurately, the whole product would fail. Test your core assumption early.
4. Ship fast, refine in production
Seven days to launch meant some features were basic. That's fine. Early customers gave feedback that shaped version 2.0.
5. Modern infra is a force multiplier
Supabase + Vercel means I spend zero time on DevOps. No servers, no scaling concerns, no infrastructure work. I can focus entirely on product.
The Bottom Line
Building PayoffAgent in 7 days wasn't about cutting corners. It was about using the right tools (AI + modern SaaS stack), having deep domain knowledge, and ruthlessly prioritizing what mattered for a v1.0.
If you're a solo founder or operator with industry expertise, you can now build software that would have required a full engineering team 2-3 years ago. The economics of SaaS have fundamentally changed.
Want to see PayoffAgent in action? Visit payoffagent.com for a demo, or reach out if you want help building AI-powered automation for your industry.
About Patrick Hadley
Serial entrepreneur with 25+ years building and selling businesses. Founded Hadley Media (exited in 2017), learned to code, and now build AI-powered SaaS products. Currently building SalesLeadAgent and PayoffAgent—production apps serving the commercial lending industry.

