Events
For Unicus SDK Web you will receive the following events in your website which will help you know what step the process is executing and the result of a transaction.
How to subscribe to SDK Web events?
Unicus button load
Add the following listener to detect when the Unicus Button is finished loading.
/* Add listener by pointing to the Unicus Button */
const unicusButton = document.createElement("unicus-btn");
unicusButton.addEventListener('OnUnicus:loaded', function(event) {
console.log('Unicus loaded with transaction detail: ', event.detail)
});Keep in mind the following convention to know what each object means in the response corresponding to this Event.
status_error
Boolean
Defines whether an error occurred during service loading or related to the pending process.
loaded
Boolean
Defines whether the process loaded correctly
message
String
Provides an immediate response message to the customer to let them know how the process was completed
link
String
Gives the customer the option to open the Web help modal himself.
transaction
Object
Provides an object with transaction data
transaction.transactionId
String
Corresponds to the transaction ID
transaction.clientid
String
Corresponds to the identification of the customer with whom the transaction is to be carried out.
If all goes well, you should see the following response in the (developer) console in your application.
successful
{
link: "URL/?token=<TransactionID>",
loaded: true,
message: "Unicus SDK: loaded successfully",
status_error: false,
transaction: {
transactionId: "<TransactionID>",
clientid: "<ClientID>",
},
}Important If the status_error object is set to True, it means that the transaction cannot be executed. Please check carefully the values of the client and customerid attributes corresponding to the Unicus button to see if there are any errors or inconsistencies, ultimately contact support.
Events Details
Enrollment with document and verification
Add the following addEventListener to listen when the user has an active transaction.
Liveness
status_error
Booleano
Defines whether an error occurred during service loading or related to the pending process.
message
String
Provides an immediate response message to the customer to let them know how the process was completed
transaction
Object
Provides an object with data from the transaction process
transaction.state
Object
Provides an object with data on the status of the transaction performed.
transaction.state.additionalSessionData
Object
Provides an object with transaction session data.
transaction.state.faceScanSecurityChecks
Object
Provides an object with data from the performed face scan.
Successful
Note that this event will be repeated several times as the customer repeats the document validation process.
Errors The following is a list of errors you might get.
USER_ALREADY_ENROLL:
It occurs if the user re-enrolls. This error is only possible during an internal application failure since the application automatically detects which process it should direct to.
Enrollment
status_error
Booleano
Defines whether an error occurred during service loading or related to the pending process.
message
String
Provides an immediate response message to the customer to let them know how the process was completed
transaction
Object
Provides an object with data from the transaction process
transaction.state
Object
Provides an object with data on the status of the transaction performed.
transaction.state.additionalSessionData
Object
Provides an object with transaction session data.
transaction.state.faceScanSecurityChecks
Object
Provides an object with data from the performed face scan.
Success
Note that this event will be repeated several times as the customer repeats the document validation process.
Verify
status_error
Booleano
Defines whether an error occurred during service loading or related to the pending process.
message
String
Provides an immediate response message to the customer to let them know how the process was completed
transaction
Object
Provides an object with data from the transaction process
transaction.state
Object
Provides an object with data on the status of the transaction performed.
transaction.state.additionalSessionData
Object
Provides an object with transaction session data.
transaction.state.faceScanSecurityChecks
Object
Provides an object with data from the performed face scan.
Success
Note that this event will be repeated several times as the customer repeats the document validation process.
Transaction Completion
Add the following addEventListener to listen when the user has a completed transaction.
Nombre
Tipo
Descripción
status_error
Boolean
Defines whether an error occurred during service loading or related to the pending process.
message
String
Provides an immediate response message to the customer to let them know how the process was completed
transaction
Object
Provides an object including the final state of the transaction
transaction.exited
Boolean
Provides a value given the case true or false
transaction.transactionId
String
Corresponds to the ID
Errors The following is a list of errors that you might get
USER_ALREADY_ENROLL:
It occurs if the user re-enrolls. This error is only possible during an internal application failure because the application automatically detects which process it should direct to.
Transaction error
Add the following addEventListener to listen when the user has a completed transaction.
Nombre
Tipo
Descripción
status_error
Boolean
Defines whether an error occurred during service loading or related to the pending process.
message
String
Provides an immediate response message to the customer to let them know how the process was completed
details
Object
Contains the error detail or description
Errors The following is a list of errors that you might get
USER_ALREADY_ENROLL:
It occurs if the user re-enrolls. This error is only possible during an internal application failure because the application automatically detects which process it should direct to.
Última actualización
¿Te fue útil?