Get response from widget after verifying bank details in callback function

I am using v2 widget apis and I have integrated widget in to my application in Laravel but after verifying bank details, it just show me success message.

I want that response(success message) to be in my callback function but I dont know how to use callback function in widget that give me response in my laravel function so that I can proceed furthur with response.

My code -

var params = {
// Set up the token you created in the Quickstart:
token: response.token,
config: {
// Set up the language to use:
locale: ‘es’,
entrypoint: {
// Set up the country to start:
country: ‘MX’,
// Set up the site organization type to start:
siteOrganizationType: ‘56cf4f5b784806cf028b4568’
},
navigation: {
displayStatusInToast: true
}
}
};
var syncWidget = new SyncWidget(params);
syncWidget.open();

Please explain me how to get resonse in callback function/ integration of callback function.

Thanks

Hello @miguel.paramo.

The widget comes with a variety of events (status, success, error, etc…).

In this case, you are looking for something like this.

syncWidget.$on("success", function(credential){
    // do something on success
});

You will get a credential object, which comes with the next type:

// Credential value:
Credential {
    "id_credential": "String",
    "username": "String",
    "is_new": "Number",
    "ws": "String",
    "status": "String",
    "twofa": "String"
}

Eduardo Espinosa.