Skip to Content
Docs
Get startedPartner API v4Partner API v3Android SDK
v1.0.8

Mode 2 – Orchestrator Flow

A single call to AbleCredit.startLoanFlow() drives the entire loan capture journey. You declare an ordered list of steps and a listener. The SDK sequences screens automatically and delivers lifecycle events to your listener.

Builder constraint rules

  • CREATE_LOAN_CASE, if included, must be the first step.
  • GENERATE_REPORT, if included, must be the last step.
  • At least one capture step must be present.
  • A listener must always be provided.

Sub-mode A – SDK creates loan & drives full flow

Kotlin – New Loan
val config = AbleCreditFlowConfig.Builder()
    .steps(
        AbleCreditFlowStep.CREATE_LOAN_CASE,          // must be first
        AbleCreditFlowStep.RECORD_AUDIO,
        AbleCreditFlowStep.CAPTURE_BUSINESS_PHOTOS,
        AbleCreditFlowStep.CAPTURE_FAMILY_PHOTOS,
        AbleCreditFlowStep.CAPTURE_COLLATERAL_PHOTOS,
        AbleCreditFlowStep.GENERATE_REPORT,           // must be last if included
    )
    .listener(object : AbleCreditFlowListener {
        override fun onLoanCreated(applicationId: String, response: AbleCreditLoanResponse) {
            // Fires before first capture step – persist loan_reference here
            val loanRef = response.data.application.loan_reference
            myStore.save(applicationId, loanRef)
        }
        override fun onStepCompleted(step: AbleCreditFlowStep) { /* optional */ }
        override fun onFileStatusChanged(
            step    : AbleCreditFlowStep,
            uniqueId: String,
            status  : AbleCreditFileStatus,
            message : String?
        ) { }
        override fun onFlowCompleted(applicationId: String) { /* all steps done */ }
        override fun onFlowFailed(step: AbleCreditFlowStep, error: AbleCreditResult.Failure) { }
    })
    .withNewLoan(payload)

AbleCredit.startLoanFlow(context, config)

Sub-mode C – LOS loan handed into the flow

Kotlin – Existing Loan
val config = AbleCreditFlowConfig.Builder()
    .steps(
        AbleCreditFlowStep.RECORD_AUDIO,
        AbleCreditFlowStep.CAPTURE_BUSINESS_PHOTOS,
        AbleCreditFlowStep.GENERATE_REPORT,
    )
    .listener(object : AbleCreditFlowListener {
        override fun onFlowCompleted(applicationId: String) { }
        override fun onFlowFailed(step: AbleCreditFlowStep, error: AbleCreditResult.Failure) { }
        override fun onStepCompleted(step: AbleCreditFlowStep) { }
    })
    .withExistingLoan(loanApplicationId)

AbleCredit.startLoanFlow(context, config)

Available flow steps

StepConstraint
CREATE_LOAN_CASEMust be first, if included
RECORD_AUDIOCapture step
CAPTURE_BUSINESS_PHOTOSCapture step
CAPTURE_FAMILY_PHOTOSCapture step
CAPTURE_COLLATERAL_PHOTOSCapture step
GENERATE_REPORTMust be last, if included

On this page