Instantor API docs
  • Introduction
  • Getting started
  • Widget implementation
    • A step-by-step guide
  • Widget configuration
    • Identify your customer
    • Pre-select a bank
    • Listen to Widget events
    • Other methods
  • Report delivery
    • Delivery introduction
    • Delivery methods
    • Report example
    • Report status definitions
Powered by GitBook
On this page

Was this helpful?

  1. Widget configuration

Listen to Widget events

The attachEventListener method is an optional method for attaching callback functions to specific Widget events.

instantor.attachEventListener(eventName, callbackFunction(payload))

This method attaches an event listener with a specified callback function to the specified event, eventName. When triggered, the callback function is called with an event payload.

Event Name

Payload Example

Description

load

{

status: true

}

Triggered when the Widget has loaded.

The payload contains status true if loading was successful.

processEnd

{

"process-finished"

}

Triggered when the process has ended, i.e. the user completed the last login step.

The payload contains a representation of the result:

"process-finished"

"invalid-login"

"process-error"

chooseBank

{

bankAbbreviation: "se-swedbank",

bankID: "uuid",

sessionID: "uuid"

}

Triggered when the user selects a bank.

The payload contains a representation of the bank and session data:

bankAbbreviation (bank abbreviation)

bankID (unique bank ID)

sessionID (unique session ID).

error

{

message: "error message"

}

Triggered when an error occurs.

The payload contains a description of the error.

displayChange

{

display:

"bankLogin"

}

Triggered when the Widget changes content.

The payload contains a representation of what is displayed:

"bankLogin" (the Widget renders a bank login form)

"bankChooser" (the Widget renders the bank chooser)

Example

An example of how to use attachEventListener

const instantor = new Instantor('produktKey.example')
  
instantor.attachEventListener('chooseBank', function(payload) {
  console.log("The user selected this bank: " + payload.bankAbbreviation);
})
  
instantor.load('#instantor_div');
PreviousPre-select a bankNextOther methods

Last updated 5 years ago

Was this helpful?