Loans were getting stuck in pending activation. Sometimes a payout had succeeded but the loan had not moved forward. Sometimes the provider’s answer was still unclear. From a lender’s point of view, both looked like a loan that had stopped without explaining why.

Operations had the harder version of the same problem. They had to move between dashboards and run queries to work out whether a transfer happened, whether the loan had been activated and whether it was safe to try again. The approval code had grown into one large routine that mixed validation, schedules, wallet setup, provider calls and activation. It could do the happy path, but it gave us a poor answer when one of those steps failed.

Approval was not a transfer

I broke the routine into an approval flow and a disbursement flow. Approval prepares the loan and records that it is ready for activation. Disbursement handles the transfer, its provider-specific steps and the final loan state. Provider adapters keep the differences between payout channels out of the core workflow.

That separation made failures easier to locate. An engineer can follow the step that failed instead of reading through one long function and guessing where the loan stopped. It also means a failed payout does not require the whole approval process to run again.

The payout went through. The loan stayed pending.

The dangerous case is a provider accepting a payout before our application receives a clear result. Retrying immediately could send the money twice. Leaving the loan pending forever was not much of a plan either.

I added locks and idempotent handling around attempts, then built reconciliation to compare the transfer and loan states. When a payout is confirmed, the flow can finish activating a stranded loan without initiating another transfer. When the outcome is uncertain, it stays pending until there is evidence to settle it. Recovery starts from what happened to the money, not from how many times someone clicked a button.

Payout webhooks were another missing piece. Without those callbacks, polling carried too much of the status work and a successful transfer could take longer to reach the loan. I connected provider payout events to the settlement path so confirmed outcomes can be handled when they arrive, with reconciliation still available when an event is delayed or missed.

A status lenders could use

The backend can know the difference between pending, failed and reversed, but that distinction is only useful if the lender can understand it. I worked on the admin loan and transaction views to turn disbursement results into plain descriptions and next steps. An uncertain transfer should say it is being confirmed and warn against an unsafe retry. A failed one should explain the issue when we have a useful reason.

The improvement is a clearer path for everyone involved. Operations have fewer mysteries to reconstruct across dashboards. Engineers have smaller steps to trace and a recovery path to maintain. Lenders can see what the status means rather than staring at pending activation and hoping it develops a personality.

For a payout flow, the real success condition is not just that money moved. The loan, the transfer and the people looking at them all need to agree on what happened.