Skip to main content

Events

When integrating any of the SDKs, it is necessary to configure the events required for its operation. These events are documented below:

onSDKReady

Callback that executes when the SDK loads successfully. Upon successful SDK loading, a message is sent to the iframe with the integration information.

Usage Example

function onSDKReady() {
console.log('SDK Initialized Successfully');
//....
}

onSDKClose

Callback that executes when the SDK is closed due to the flow ending. It is not executed when it is force-closed (e.g., by closing the tab).

Usage Example

/**
* @param {string} code - Code of the created document.
*/
function onSDKClose(code) {
console.log('Document created:', code);
//....
}

onSDKToken

warning

If the public key is included in the integration library, this event is not called, although it is recommended to include it and return the public key string.

Callback that executes when the SDK requires an authorization token to extract information from the API.

Usage Example

/**
* @returns Promise<string> - This function should return a promise that
* resolves the authentication key string
*/
function onSDKToken() {
return new Promise((resolve) => {
//....
resolve('authKey');
});
}