Home

Document Upload SDK

Overview

Highnote's document upload SDK allows you to collect identity verification documents from account holders when a card product application enters manual review.

This guide provides an overview of requirements, installation steps, and usage guidelines for the document upload SDK.

Prerequisites

  1. A Highnote account
  2. A server-side integration using an API key
  3. Document upload session ID
  4. An HTML selector for injecting a DOM element

Installation

You can install the document upload SDK using JavaScript package managers or CDN. For more installation information, see the SDK Installation guide.

JSDelivr Script Tag

Usage

To use the document upload SDK, you must fetch a document upload session ID and set up elements for each field. This involves the following steps:

  1. Prepare your HTML.
  2. Fetch document upload session ID
  3. Fetch a client token.
  4. Initialize document upload.

Prepare your HTML

To use the document upload SDK, you must provide an element to append the HTMLDivElement to. The document upload library will use the HTMLDivElement to render the appropriate document upload widget. You can style the content inside the widget by passing any combination of styling options.

The following code sample shows an example how you can prepare your HTML for the document upload SDK:

Prepare HTML

Fetch document upload session ID

If an account holder's card product application status is IN_REVIEW , they must provide specific documents for Customer Identification Program (CIP) verification. To use the document upload SDK for document collection, you must use a document upload session ID to start a secure document upload session.

Use the following query to retrieve a card product application and fetch your document upload session ID:

Fetch a client token

To obtain a client token from your server for the document upload SDK, use the generateDocumentUploadClientToken mutation.

Refer to the following guidelines when generating a payment card client token:

  • When generating the client token, you must provide the documentUploadSessionId of the payment card you are rendering.
  • The client token is only valid for 10 minutes, but can be used multiple times.
  • Once a token expires, you must generate a new one to render payment card details.

Use the following mutation to generate a document upload client token:

Initialize document upload

You can initialize the document upload SDK by calling an initializeDocumentUploadSdk function. This returns a Promise containing a reference to the documentUpload instance, which includes helper methods to enact on the SDK such as unmount and endSession.

The following code sample is an example of an initializeDocumentUploadSdk function:

Initialize Document Upload

Error types

The following error types are supported for the document upload SDK:

ErrorDescription
InvalidCredentialErrorThis error occurs when the provided client token is invalid or expired. The payload will contain the requestId, which can be used for support and debugging.
DocumentUploadRequestErrorThis error represents errors encountered when communicating with the Highnote API. The payload will contain the requestId, which can be used for support and debugging.
DocumentUploadConfigurationErrorThis error is raised when an invalid configuration is provided at runtime. Example messages include:
Invalid client token.
Invalid Document Upload Session ID.
Invalid environment. Please provide test or live.
GenericDocumentUploadErrorAll unknown and unexpected errors.

The following code sample provides examples of document upload errors:

Error Examples

Styling options

The following styling options are available for use in elements for your document upload widget:

HTML ElementidDescription
<div>document-upload-componentThe selector provided during initialization of the SDK.
<div>inner-document-upload-componentThe <div> that is rendered by the SDK.
<div>reloaded-document-upload-componentThe <div> that contains documents required and documents uploaded. This <div> reloaded on each new upload.
<div>stagnant-document-upload-componentThe <div> that contains all elements that are not reloaded.
<input>file-upload-componentThe file selector for uploads.
<select>document-typeThe list of documents to be uploaded.
<button>document-upload-buttonButton to upload required documents.
<h4>All section headings.
<p>All informational text.

Using the live environment

By default, the card viewer library will make requests against the test environment. When you are ready to switch to the live environment, set the environment configuration option using the following function call:

Live Environment

Lifecycle

When the document upload SDK initializes, it automatically renders the required document upload widget and closes the sessions once all requirements are met. You are required to handle onSuccess and onError behavior as you wish. The rendered widget contains two sections:

  1. Documents uploaded: Includes documents already uploaded
  2. Documents required: Includes a drop-down of the required documents and a method for uploading them

The widget guides the user through the document upload process with reloaded components triggered by an upload event on subsequent steps. When no more documents are left to be uploaded, the SDK will end the document upload session and submit uploads for review.

Documents uploaded.png

Interactions

The document upload SDK supports the following interactions:

  • Allows account holder to upload documentation
  • Unmount the SDK
  • End the document upload session

Upload document

Once the SDK is initialized, the document upload widget provides the applicant with a list of uploaded documents and a dropdown menu with outstanding, required documents.

The account holder can pick a document to upload and click on the Upload button. The applicant must be able to successfully upload all required documents until no document type options remain to select from the dropdown.

Unmount SDK

The document upload SDK provides a call-back function for you to unmount the SDK. This allows you to decouple it with the client-token for a fresh start at any time.

End session

Warning: This action will submit any uploaded documents for review.

The document upload SDK provides a call-back function for you to end a document session at any time.

Provide Feedback

Was this content helpful?