# JS Button

The ID Check Javascript Button is the easiest way to implement ID Check on your website. The button provides a seamless user experience, takes the user through the ID Check process on their phone and notifies your page when the process is complete.

# Caisson(public_api_key)

Use Caisson(public_api_key) to initialize the Caisson library. Your public api key is required.

# caisson.button(options)

Create an ID Check button element. It accepts a configuration object. The available options are:

  • customer_id(Optional): A string identifying this specific ID Check in your system. The field will be displayed in the dashboard next to each ID Check. This is a free-form string that can be populated with the anything that may help identify ID Checks within your application.
  • appearance(Optional): A string specifying the background color of the button. Available options are: "light" and "dark". Defaults to "dark".
# Return value:

A button DOM element to be mounted on your page.

# button.on(event, handler)

The ID Check button emits several events during the ID Check process. Use the on() method to register an event handler.

Event Payload
idCheckCreated Fired when the ID Check is created after the button is clicked. The handler will receive an idCheck object with the following fields:
  • check_exchange_token - a token for retrieving the Check's identifier
  • customer_id - the identifier provided when creating the button
  • url - the URL for the ID Check process
You should upload the check_exchange_token to your server for retrieving ID Check results. See Exchange Check Token for more details.
idCheckComplete Fired when your user completes the ID Check flow on their mobile device. The handler receives no payload.
error Fired when an error occurs during the process of creating the ID Check. The payload is an error string describing the error that occurred.

# button.mount(cssSelector)

The button.mount() method attaches the ID Check button to the DOM. It accepts a CSS Selector. Here's an example:

    <div id="caisson-button"></div>
    button.mount("#caisson-button");