Note
This guide is specific to Web SDK 2.0. If you are still using 1.x, you can find documentation here. Contact your Incode Representative for upgrade information and check if you are a candidate for this upgrade.
Full rollout to all clients still TBD.
The Document Capture module captures generic documents (utility bills, lease agreements, tax documents, address proofs, vehicle logbooks, etc.) — anything that isn't an identity document but needs to be uploaded as part of verification. Supports both camera-based capture and file-picker upload, with optional multi-page support.
Follows the camera-capture pattern, but extends it with file-upload alternatives and multi-page state. See the patterns page for the shared lifecycle.
Tag
<incode-document-capture> is a standard Web Component. Importing the UI subpath registers the custom element; importing the CSS applies the module's styles.
import '@incodetech/web/document-capture';
import '@incodetech/web/document-capture/styles.css';
Properties
| Property | Type | Required | Description |
|---|---|---|---|
config |
DocumentCaptureConfig |
❌ | Configuration options |
onFinish |
() => void |
❌ | Called when capture completes |
onError |
(error: string | undefined) => void |
❌ | Called when an error occurs |
Configuration
type DocumentCaptureConfig = {
processingType?: DocumentType; // Backend routing key (default 'addressStatement')
captureMode?: 'file' | 'camera'; // 'camera' = capture only (hides upload); 'file' = upload only (hides camera); absent = capture + upload
allowSkipDocumentCapture?: boolean; // Default false
disableSkipPoa?: boolean; // Backend ADDRESS field; inverse of allowSkipDocumentCapture
title?: string; // Tutorial screen title override
text?: string; // Tutorial screen text override
step2Title?: string; // Multi-page tutorial second-page title
step2Text?: string; // Multi-page tutorial second-page text
captureAttempts?: number; // Default 3
sendBase64?: boolean; // Default false (sends raw bytes)
maxFileSize?: number; // Default 10 MB
onlyPdf?: boolean; // Default false. Restrict uploads to PDF; camera capture unaffected
};
processingType accepts: addressStatement, otherDocument1, otherDocument2, otherDocument3, v5cMultiPageLogbook, circulationCard, financeSettlement, carInvoice, w8Ben, w8BenE, plus process* variants for OCR-driven processing — including processW8BenOcr and processW8BenEOcr for the IRS W-8 tax forms. The multi-page types (v5cMultiPageLogbook, circulationCard, financeSettlement, w8BenE) trigger the nextPage flow described below. W-8BEN is single-page; W-8BEN-E is multi-page.
Set onlyPdf: true when the document only makes sense as a PDF, such as a tax form the user downloads and re-uploads. It narrows the file picker and rejects non-PDF selections; it does not disable camera capture, so pair it with captureMode: 'file' for a PDF-only step.
State machine
DocumentCaptureState is a discriminated union over status. The 11 states extend the camera-capture pattern with file-upload and multi-page handling:
| Status | Description |
|---|---|
tutorial |
Initial guidance screen. |
initializingCamera |
Camera starting up (when camera capture is offered and the user picks camera). |
capturing |
Live camera preview, ready to capture. |
preview |
After capture or file pick, user reviews the image before accept/retake. |
uploading |
Uploading the (accepted) image to the backend. |
success |
Upload accepted; transitioning out. |
nextPage |
Multi-page document; backend asked for an additional page. User can capture or skip. |
finalizing |
Server-side finalization after all pages uploaded. |
failure |
Upload or finalization failed; user can retry. |
finished |
Terminal — module complete. |
closed |
User dismissed. |
API methods
| Method | Purpose |
|---|---|
capture() |
Trigger camera capture (when capturing). |
setFile(file, imageBase64) |
Provide a file from the picker (when capturing or nextPage). |
accept() |
Accept the previewed image and start uploading. |
retake() |
Reject the preview and return to capturing. |
retry() |
Retry from failure state. |
continue() |
Continue from nextPage after all pages captured. |
skip() |
Skip this step (only when allowSkipDocumentCapture is true). |
close() |
Dismiss the module (transitions to closed). |
captureNextPageFromCamera() |
In nextPage state, switch back to camera for the next page. |
captureNextPageFromFile() |
In nextPage state, open file picker for the next page. |
finishPageCapture() |
Mark all pages captured; transitions to finalizing. |
Plus the universal lifecycle: subscribe, getState, reset, stop.
Capture-method selection and help
When the step offers both camera and upload, the tutorial state lets the user choose between them, and the capturing state can show a "common issues" help overlay. Both are overlays over an existing state rather than states of their own, so each is driven by a boolean on the state you are already in:
| Method | Purpose | Callable when |
|---|---|---|
openMethodSelection() |
Open the camera-or-upload chooser. Sets methodSelectionOpen to true. |
tutorial |
closeMethodSelection() |
Dismiss the chooser without picking. | tutorial, chooser open |
selectUploadMethod() |
Pick upload, which switches the chooser to its upload variant. | tutorial, chooser open |
deselectUploadMethod() |
Return to the camera-or-upload choice after picking upload. | tutorial, upload picked |
openHelp() |
Open the "common issues" overlay over the camera view. Sets helpOpen. |
capturing |
closeHelp() |
Dismiss the help overlay. | capturing, help open |
Read methodSelectionOpen from the tutorial state and helpOpen from the capturing state to decide what to render. Both default to false, so an integration that ignores them keeps the previous behavior.
WASM requirement
Camera-mode capture uses WASM for image quality checks. Preload via setup({ wasm: { pipelines: ['idCapture'] } }) if you'll be running this module in camera mode. Upload-only mode (captureMode: 'file') does not require WASM.