Skip to main content

Event System

The Spidify SDK is deeply integrated with an event-driven architecture, allowing your application to react dynamically as users progress through the KYC workflow.

Event Emitter

The KycSDK instance acts as an EventEmitter. You can listen to events using the .on() method.

sdk.on('event_name', (payload) => {
// Handle event
});

Available Events

EventPayloadDescription
init{ sessionId: string, steps: any[] }Triggered when the session is successfully initialized.
step_started{ step: string }Triggered when a new KYC step begins.
step_completed{ step: string, data?: any }Triggered when a step is successfully finished.
step_failed{ step: string, error: string }Triggered when a step encounters an error.
finishedvoidTriggered when the entire workflow is complete.
errorstringTriggered on global or initialization errors.

Managed UI Handshakes

If you are using the Managed UI (SpidifySDK), these internal events are bubbled up to you via the onStep configuration callback, utilizing the SpidifyHandshakeEvent type.

const Spidify = new SpidifySDK({
// ...other options
onStep: (event) => {
console.log(`Step: ${event.step} is ${event.status}`);
}
});