Dynamic SDK Callbacks
This page outlines the Dynamic SDK callbacks and explains the purpose of each one.
Journey Level Callbacks
Subscribe to these callbacks to handle journey level events:
extension ViewController:IDWiseJourneyCallbacks {
func onJourneyStarted(journeyStartedInfo: JourneyStartedInfo) {
print("IDWiseSDKCallback", "onJourneyStarted")
}
func onJourneyCompleted(journeyCompletedInfo: JourneyCompletedInfo) {
print("IDWiseSDKCallback", "onJourneyCompleted")
}
func onJourneyResumed(journeyResumedInfo: JourneyResumedInfo) {
print("IDWiseSDKCallback", "onJourneyResumed")
}
func onJourneyCancelled(journeyCancelledInfo: JourneyCancelledInfo) {
print("IDWiseSDKCallback", "onJourneyCancelled")
}
func onError(error : IDWiseError) {
print("IDWiseSDKCallback", "onError \(error.message)")
}
}
val journeyCallbacks = object : IDWiseJourneyCallbacks {
override fun onJourneyStarted(journeyStartedInfo: JourneyStartedInfo) {
Log.d("IDWiseSDKCallback", "onJourneyStarted $journeyStartedInfo")
}
override fun onJourneyCompleted(journeyCompletedInfo: JourneyCompletedInfo) {
Log.d("IDWiseSDKCallback", "onJourneyCompleted $journeyCompletedInfo")
}
override fun onJourneyResumed(journeyResumedInfo: JourneyResumedInfo) {
Log.d("IDWiseSDKCallback", "onJourneyResumed $journeyResumedInfo")
}
override fun onJourneyCancelled(journeyCancelledInfo: JourneyCancelledInfo) {
Log.d("IDWiseSDKCallback", "onJourneyCancelled $onJourneyCancelled")
}
override fun onError(error: IDWiseError) {
Log.d("IDWiseSDKCallback", "onError $error")
}
}
IDWiseJourneyCallbacks _journeyCallbacks = IDWiseJourneyCallbacks(
onJourneyStarted: (dynamic journeyStartedInfo) {
print("IDWiseJourneyCallbacks: onJourneyStarted, $journeyStartedInfo");
},
onJourneyCompleted: (dynamic journeyCompletedInfo){
print("IDWiseJourneyCallbacks: onJourneyCompleted: $journeyCompletedInfo");
},
onJourneyCancelled: (dynamic journeyCancelledInfo){
print("IDWiseJourneyCallbacks: onJourneyCancelled: $journeyCancelledInfo");
},
onJourneyResumed: (dynamic journeyResumedInfo) {
print("IDWiseJourneyCallbacks: onJourneyResumed, $journeyResumedInfo");
},
onError: (dynamic error){
print("onError $error");
}
);
const journeyCallbacks = {
onJourneyStarted(journeyStartedInfo) {
console.log('onJourneyStarted:', journeyStartedInfo);
},
onJourneyResumed(journeyResumedInfo) {
console.log('onJourneyResumed:', journeyResumedInfo);
},
onJourneyCompleted(journeyCompletedInfo) {
console.log('onJourneyCompleted:', journeyCompletedInfo);
},
onJourneyCancelled(journeyCancelledInfo) {
console.log('onJourneyCancelled:', journeyCancelledInfo);
},
onError(error) {
console.log('onError:', error);
},
};
const journeyCallbacks = {
onJourneyStarted(journeyStartedInfo) {
console.log(`Journey Started with id ${journeyStartedInfo.journeyId}`);
},
onJourneyResumed(journeyResumedInfo) {
console.log(`Journey Resumed with id ${journeyResumedInfo.journeyId}`);
},
onJourneyCompleted(journeyCompletedInfo) {
console.log(`Journey Fininshed with id ${journeyCompletedInfo.journeyId}`);
},
onJourneyCancelled(journeyCancelledInfo) {
console.log(`Journey Cancelled with id ${journeyCancelledInfo.journeyId}`);
},
onError(error) {
console.log(
"Event onJourneyError received:",
error.code,
error.message
);
},
};
Callback | Description | Payload Object |
---|---|---|
onJourneyStarted | Triggered when a user's journey started. It's recommended to save the journey ID in your system under the user's profile. You can now call the startStep method to initiate any step in the journey. | JourneyStartedInfo Object:- journeyId : The unique ID of the journey |
onJourneyResumed | Triggered when a user's journey resumed. You can now call the startStep method to initiate any non-concluded step in the journey. In order to get non-concluded steps you can check here | JourneyResumedInfo Object:- journeyId : The unique ID of the resumed journey |
onJourneyCompleted | Triggered when the user completes all steps (e.g., Document and Selfie). Please Note do not consider the journey is fully processed at this point. Your backend should call the IDWise backend to retrieve the final journey results. Additionally, your app can display a waiting screen to inform the user that the submission is in progress. | JourneyCompletedInfo Object:- journeyId : The unique ID of the journey. |
onJourneyCancelled | Not applicable for Dynamic SDK it is only applicable for Simple SDK. | |
onError | Invoked when an error occurs during the journey. Make sure you handle all errors in your application to ensure smooth user experience. | IDWiseError Object:- code : the error code, all error code can be found here |
Step Level Callbacks
Subscribe to these callbacks to handle step level events:
extension UIViewController: IDWiseStepCallbacks {
func onStepCaptured(stepCapturedInfo: StepCapturedInfo) {
//This event triggers when User has captured the image from the camera
}
func onStepResult(stepResultInfo: StepResultInfo) {
//This event is triggered when Image processing is completed at the backend.
//stepResult contains the details of the processing output
}
func onStepCancelled(stepCancelledInfo: StepCancelledInfo) {
// This event triggers when a step is cancelled
}
func onStepSkipped (stepSkippedInfo: StepSkippedInfo) {
// This event is triggered when a step is skipped
}
}
val stepCallbacks = object : IDWiseStepCallbacks {
override fun onStepCaptured(stepCapturedInfo: StepCapturedInfo) {
//This event triggers when User has captured the image from the camera
Log.d("IDWiseSDKStepCallback", "onStepCaptured $stepCapturedInfo")
}
override fun onStepResult(stepResultInfo: StepResultInfo) {
//This event is triggered when Image processing is completed at the backend.
//stepResult contains the details of the processing output
Log.d("IDWiseSDKStepCallback", "onStepResult $stepResultInfo")
}
override fun onStepCancelled(stepCancelledInfo: StepCancelledInfo) {
// This event triggers when a step is cancelled
Log.d("IDWiseSDKStepCallback", "onStepCancelled $stepCancelledInfo")
}
override fun onStepSkipped(stepSkippedInfo: StepSkippedInfo) {
// This event is triggered when a step is skipped
Log.d("IDWiseSDKStepCallback", "onStepSkipped $stepSkippedInfo")
}
}
//Declare global variables to be passed to initialize later
late IDWiseSDKStepCallbacks _stepCallbacks;
_stepCallbacks = IDWiseStepCallbacks(
onStepCaptured: (dynamic stepCapturedInfo) {
print("IDWiseStepCallbacks onStepCaptured, $stepCapturedInfo");
},
onStepResult: (dynamic stepResultInfo) {
print("IDWiseStepCallbacks onStepResult, $stepResultInfo");
},
onStepCancelled: (dynamic stepCancelledInfo) {
print("IDWiseStepCallbacks onStepCancelled, $stepCancelledInfo");
},
onStepSkipped: (dynamic stepSkippedInfo) {
print("IDWiseStepCallbacks onStepSkipped, $stepSkippedInfo");
}
);
const stepCallback = {
onStepCaptured(stepCapturedInfo) {
console.log('onStepCaptured:', stepCapturedInfo);
},
onStepResult(stepResultInfo) {
console.log('onStepResult:', stepResultInfo);
},
onStepCancelled(stepCancelledInfo) {
console.log('onStepCancelled:', stepCancelledInfo);
},
onStepSkipped(stepSkippedInfo) {
console.log('onStepSkipped:', stepSkippedInfo);
}
};
const stepCallback = {
onStepCaptured(stepCapturedInfo) {
console.log('onStepCaptured:', stepCapturedInfo);
},
onStepResult(stepResultInfo) {
console.log('onStepResult:', stepResultInfo);
},
onStepCancelled(stepCancelledInfo) {
console.log('onStepCancelled:', stepCancelledInfo);
},
onStepSkipped(stepSkippedInfo) {
console.log('onStepSkipped:', stepSkippedInfo);
}
};
Callback | Description | Payload Object |
---|---|---|
onStepCaptured | Triggered when the user captures and confirms the image. The IDWise UI is hidden, and control returns to your app to display any necessary UI. The callback payload includes the captured images, with both sides provided for two-sided documents. | StepCapturedInfo Object:- stepId : identifies the step- originalImage : full image- croppedImage : cropped image- originalImageBack : full back image- croppedImageBack : cropped back image |
onStepResult | Triggered when a step finishes processing. The callback payload contains the initial processing results for that step, which you can display to the user for confirmation. Note that these are not the final results; the complete outcome will be provided once the entire journey is fully processed. | StepResult Info |
onStepCancelled | Triggered when the user cancels this step. UI control is returned to your app. | StepCancelledInfo Object:- stepId : The value of the step |
onStepSkipped | Triggered when you call IDWise.skipStep(stepId:) . This callback is triggered only if the step is successfully skipped. | StepSkippedInfo Object:- stepId : The value of the step |
Updated 3 months ago