Delivered remotely for a business based in Utrecht, Netherlands. Names withheld by agreement.
Project Overview
Once a consumer loan originates, borrower satisfaction and collection performance depend heavily on how smoothly routine servicing works. Borrowers need clear visibility into principal versus interest splits, upcoming due dates, early payoff amounts, and historical receipts. When those answers require waiting on hold with a servicing desk—or navigating brittle legacy forms—missed payments rise alongside support overhead.
We built a dedicated borrower self-service portal and companion servicing API using Laravel, PHP, Blade, and Laravel Sanctum over MySQL and Redis. Borrowers sign in from any browser to inspect real-time balances, download statements, submit one-time or recurring repayments, and request payment-date adjustments, while authorized servicing integrations interact with the exact same domain rules through Sanctum-protected endpoints.
Business Bottleneck
Consumer loan servicing teams routinely struggle with four operational pressures when customers lack dependable self-service tools:
- High inbound call volume for routine math: Agents spend hours reading payoff quotes, clarifying late-fee calculations, and emailing duplicate statements that borrowers could verify instantly online.
- Payment reconciliation mismatches: Disconnected payment links and core loan ledgers create delayed balance updates, prompting worried borrowers to submit duplicate payments.
- Fragile direct-debit failure handling: When an automated debit bounces, slow notification loops leave borrowers unaware until late fees accumulate.
- Inconsistent validation between web and API channels: Maintaining separate business logic for browser portals and partner APIs introduces divergent fee rules or authorization gaps.
Architectural Strategy
We unified portal and API behavior inside a single Laravel modular domain core. Rather than duplicating loan calculations across frontend JavaScript and backend PHP, server-rendered Blade views and Sanctum API controllers call shared Laravel action classes for amortization inspection, payoff quoting, and payment initiation.
Money movement follows a strict state machine rather than optimistic balance edits. Every repayment creates an immutable intent record locked by an idempotency token, and only verified payment-gateway webhooks or reconciliation batches post cleared allocations to the loan ledger.
Core Capabilities
- Interactive Loan Dashboard & Schedule: Displays remaining principal, accrued interest, next installment breakdown, payment history, and clear overdue status indicators.
- Deterministic Payoff Quote Calculator: Generates time-bounded early settlement figures incorporating exact per-diem interest and applicable terms without manual agent intervention.
- Idempotent One-Time & Recurring Payments: Supports card payments and SEPA direct debit mandates with immediate pending confirmations and automated mandate management.
- Hardship & Due-Date Modification Requests: Guided self-service workflows let eligible borrowers submit structured rescheduling requests routed straight to servicing queues.
- On-Demand Statement & Tax PDFs: Generates compliant monthly statements, payment receipts, and annual interest summaries delivered via authenticated downloads.
Technical Architecture
Borrowers access Blade views served over HTTPS with strict Content Security Policy headers and Laravel session cookies, while mobile or partner clients authenticate via Laravel Sanctum bearer tokens. Incoming requests pass through policy-enforced controllers into domain services that compute schedules using integer minor units and BCMath precision against MySQL.
Flow: Borrower Browser (Blade) / API Client (Sanctum Token) → Laravel Middleware & Policy Layer → Loan Servicing Domain Actions → MySQL InnoDB Ledger + Redis Queues ↔ Payment Gateway Webhooks
When a borrower authorizes a payment, Laravel acquires a short-lived Redis lock on the loan account, persists a pending payment intent in MySQL, and dispatches the tokenized request to the payment gateway. Asynchronous settlement confirmations or failure codes arrive at signed webhook endpoints, enqueueing Laravel Redis jobs that update installment allocations, refresh cached summary balances, and send transactional email notifications.
Technology Stack
| Category | Technology detail |
|---|---|
| Backend Framework | Laravel (PHP 8.4) with modular service and ledger domain classes |
| Web Presentation | Server-rendered Laravel Blade templates with strict CSP headers |
| Frontend Styling | Tailwind CSS compiled cleanly for accessible desktop and mobile forms |
| API Authentication | Laravel Sanctum (cookie SPA sessions and scoped bearer tokens) |
| Database & Ledger | MySQL with InnoDB row locking and minor-unit integer accounting |
| Queues & Cache | Redis for queue workers, distributed payment locks, and rate limits |
| Payment Gateway Sync | Signed webhook handlers for SEPA direct debit and card settlements |
| Document Generation | Queued PDF generation for amortization schedules and tax statements |
| Audit & Observability | Append-only servicing audit log and correlation-tracked job telemetry |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Browser XSS exposure with financial tokens in localStorage | Chose server-rendered Laravel Blade with HTTP-only encrypted cookies via Sanctum; traded SPA page transitions for strong CSRF/XSS isolation and fast initial loads. |
| Rounding drift in daily interest and split principal/interest math | Stored all amounts in integer minor units and enforced PHP BCMath calculations inside dedicated value objects rather than native floats. |
| Duplicate repayments triggered by network timeouts or impatient clicks | Bound every payment form and API call to a unique idempotency key enforced by Redis locks and MySQL unique indexes. |
| Blocking web workers during statement PDF rendering and webhook bursts | Offloaded PDF assembly, batch reconciliation, and email/SMS alerts to supervised Redis-backed Laravel Horizon/Queue workers. |
Security & Reliability
Financial self-service demands defense in depth. Laravel enforces role and ownership policies on every route so a borrower token can inspect only loans explicitly linked to their verified identity. Multi-factor verification protects sensitive changes such as updating bank mandate details or resetting credentials.
Webhook endpoints verify cryptographic HMAC signatures and replay timestamps from payment providers before touching ledger state. Database migrations wrap ledger adjustments in InnoDB transactions with lockForUpdate() semantics, while PII redaction filters scrub IBANs, tax numbers, and tokens from structured application logs. Automated daily reconciliation jobs compare internal cleared payment records against gateway settlement reports to catch discrepancies early.
Performance & Scale
Server-rendered Blade views styled with purged Tailwind CSS ship minimal payloads to borrowers on mobile connections, rendering balances and payment forms without waiting on client hydration. Read-heavy installment histories use eager-loaded Eloquent queries and short-lived Redis summary caches invalidated strictly upon ledger events.
Queue workers isolate heavy PDF generation and scheduled reminder dispatches from interactive web PHP-FPM pools, ensuring payment confirmation screens remain snappy even during end-of-month billing runs when statement downloads and due-date reminders peak together.
Operational Outcomes
Launching a dedicated self-service portal restructured how borrowers and servicing staff handled everyday account tasks:
- Reduced servicing desk friction: Borrowers retrieve payoff quotes, review amortization splits, and download statements independently without waiting on agent callbacks.
- Cleaner payment reconciliation: Idempotent payment intents and webhook-driven ledger posting eliminated ambiguous pending states and manual spreadsheet matching.
- Faster cure of missed installments: Automated failure notices link borrowers directly to one-click catch-up payment pages inside their Blade portal.
- Unified compliance posture: Having web forms and Sanctum API endpoints share one Laravel domain core keeps fee calculations, audit trails, and access policies consistent across channels.