NAV Navbar
javascript
  • Verifai Windows SDK (v 1.1)
  • Verifai Windows SDK (v 1.1)

    Welcome to the Verifai for Windows implementation guide. Because this version has been written with a special usecase in mind it is a little
    different than other SDKs.

    This documentation will continue as we add extra features.

    Prerequisites

    You can for example use a Microsoft Surface Pro.

    A suitable device

    Install the software

    You can download the latest SDK from our portal. If you have done that you will be guided through the installation.

    There will be a "service" installed that handles communication between the browser plugin and the actual Verifai application that does the heavy lifting.

    Setting the licence

    If you open the VerifaiApp.exe that is located in the path you gave when installing (probably in C:\Program Files\Verifai\), you will be prompted for a licence.

    You can paste the licence in that textfield and it wil instant validate.

    If you need to change the licence, you can do so by clicking the "gear" icon in the top left corner of the window.

    Launching app

    // The plugin is attached to the "window" object.
    // To test if the plugin has loaded you can paste below in 
    // the browser JavaScript console.
    verifai.launch();
    

    To start scanning document you need to call the JavaScript function verifai.launch().

    This will start the app containing a camera preview with instructions to the user.

    The app will allow you to take a picture from the front and back of a document and tries to recognize the document and read the MRZ if it contains any.

    id scanning

    Handle incoming results

    <script>
    // You need to define this function so Verifai knows what to do when
    // it's finished processing.
    
    function hasResult(mrz, frontImage, backImage) {
        var decode = "data:image/jpeg;base64,";
        document.getElementById("MRZ").valueOf(mrz)
        document.getElementById("frontImage").src = decode + frontImage;
        document.getElementById("backImage").src = decode + backImage;
    }
    </script>
    
    <h1>MRZ</h1>
    
    <pre id="mrz">
    <!-- The MRZ will be placed here after scanning -->
    </pre>
    
    <!-- The hasResult function replaces the source of the images below. -->
    <h1>Images</h1>
    <table>
      <tr>
        <td><img id="frontImage" src=""></td>
        <td><img id="backImage" src=""></td>
      </tr>
    </table>
    

    When the user is finished in the Verifai flow, he will return back to the browser instance. The plugin calls a function that you have to define (a callback).

    That function has to be named hasResult, and it must accept the following parameters:

    id result

    Note that this script also JSON decodes the data.

    A full working example is available.

    Take photos

    // Launch the camera
    verifai.launchCamera('Take a picture of tha bank statement');
    
    // Get the results back
    function hasCameraResult(image) {
        var decode = "data:image/jpeg;base64,";
        document.getElementById('bankstatement-image').src = decode + image;
    }
    

    Because Microsoft had discontinued camera support for Internet Explorer 11 with the introduction of Windows 8.1 (it worked in 8.0) we implemented a similar functionality into the Verifai for Windows SDK.

    It is heavily inspired by the ID Scanning flow, so it shouldn't be hard to implement this.

    The launch function is called launchCamera, and the callback is hasCameraResult. You can however send a string parameter to launchCamera so you can provide the user with instructions.

    For example: verifai.launchCamera('Take a picture of the debit card').

    The hasCameraResult has a base64 image as it's only parameter.

    Notes

    Because the Windows version is developed for a special use case it is possible that it does not fit your needs.

    Please contact our sales department if you have any additional requests. Chances are that we might add that functionality so you can use our product.

    Happy coding!