## Customize Your Capture App Flow

The Predictive Document Verification (DocV) Web SDK includes customizable options that allow you to modify the user interface and user experience of the Capture App flow.

After completing your SDK integration, use this section to learn how to build and deploy a customized flow that matches your organization's style, branding, and document verification use case.

## Step 1: Build your Capture App flow in RiskOS™

On the **DocV App** page in RiskOS™:

1. Select your [Capture App flow use case](https://help.socure.com/riskos/docs/customization-branding-copy#/), then customize the Capture App UI to match your application's theme.
2. When you are finished, save the flow to the **Production** environment.

## Step 2: Deploy your custom flow

The DocV Web SDK requires you to make a `POST` request to the [/api/evaluation](https://help.socure.com/riskos/reference/postevaluation#/) endpoint to generate a `docvTransactionToken`. You can deploy your custom flow settings using the `data.individual.docv.config` object parameters in the API request body. The `docvTransactionToken` returned in the API response will automatically apply your Capture App flow settings to the transaction.

```shell
curl --location 'https://riskos.socure.com/api/evaluation' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer a182150a-363a-4f4a-xxxx-xxxxxxxxxxxx' \
  --header 'content-type: application/json' \
  --header 'X-API-Version: 2025-01-01.orion' \
  --data-raw '{
  ...
    "docv": {
      "config": {
        "send_message": false,
        "language": "en",
        "use_case_key": "customer_use_case_key",
        "redirect": {
          "method": "GET",
          "url": "https://www.socure.com",
          "document_type": "license"
        }
      }
    }
  }'
```

The following table lists the `config` object parameters:

| Parameter         | Type   | Description |
|-------------------|--------|-------------|
| `send_message`    | Bool   | Set to `true` to enable SMS text message. Default is `false`.<br>To prepopulate the consumer's phone number:<br>- Set the `send_message` field to `true`.<br>- Provide a valid mobile number. **Note:** SMS behavior varies by region. |
| `language`       | Optional | Determines the [language package](https://help.socure.com/riskos/docs/language-options#/) for the UI text.<br>Contact [support@socure.com](mailto:support@socure.com) for new language support. |
| `use_case_key`   | String  | Deploys a customized flow on a per-transaction basis. Replace with your flow name. If empty, the default flow is used. |
| `redirect`       | Object  | Contains `method` and `url` parameters for redirecting after the document capture process. |
| `method`         | String  | Defines the redirect method. Possible values are `GET` or `POST`. Required if `redirect` is provided. |
| `url`            | String  | Destination URL for redirect. Required if `redirect` is provided. |
| `document_type`  | String  | Specifies a single acceptable document type.<br>- `license`: Driver's license<br>- `passport`: Passport<br>If incorrect, the endpoint will use the defined document type in RiskOS™. |

### How the `redirect` object works

The optional `redirect` object conforms to the following type:

```ts
{
  url: string;
  method: 'GET' | 'POST';
  headers?: { [key: string]: string };
  delay?: number;
}
```

The `redirect` object allows you to redirect the consumer using:
- `url`: Destination website address with optional query strings.
- `method`: Possible values are `GET` or `POST`.
- `headers`: Optional request headers.
- `delay`: Delay before redirecting in milliseconds.

### How `document_type` works

The `document_type` field sets a default acceptable document using `license` for driver's license or `passport` for passport. It simplifies the flow, skipping the **Selected ID Type Screen** and starting directly on the **Document Capture Screen**.

## Step 3: Redirect to the Capture App

When you call the `/api/evaluation` endpoint, it returns a one-time-use document request URL for redirecting the consumer to the Capture App flow. Depending on your integration workflow, the consumer can access the URL using the methods listed below.

To send the document request URL via SMS:
1. In the API request body, set:
   - `send_message` to `true`.
   - Provider a mobile number in the `phone_number` field.

```shell
curl --location 'https://riskos.socure.com/api/evaluation' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer a182150a-363a-4f4a-xxxx-xxxxxxxxxxxx' \
  --header 'content-type: application/json' \
  --header 'X-API-Version: 2025-01-01.orion' \
  --data-raw '{
    ...
    "phone_number": "+13475550100",
    "docv": {
      "config": {
        "send_message": true,
        ...
      }
    }
  }'
```

To display a QR code:
1. Call the Evaluation endpoint.
2. Collect the base64 value in the `qrcode` field of the API response.
3. Display this value as a QR code image in your application.

> **Tip**: To disable the SMS text message, set `sendMessage` to `false`. Alternatively, set it to `true` and use the QR code as a fallback if SMS fails.

```json
{
  ...
  "response": {
    "data": {
      "docvTransactionToken": "70c6a4bc-f646-4c6a-94c1-9cd428e356ef",
      "eventId": "70c6a4bc-f646-4c6a-94c1-9cd428e356ef",
      "qrcode": "data:image/png;base64,iVBO......K5CYII=",
      "url": "https://verify.socure.com/#/dv/70c6a4bc-f646-4c6a-94c1-9cd428e356ef"
    }
  },
  ...
}
```

To redirect a consumer to the Capture App on a mobile web browser, set `send_message` to `false` in the API request.

```shell
curl --location 'https://riskos.socure.com/api/evaluation' \
  --header 'accept: application/json' \
  --header 'authorization: Bearer a182150a-363a-4f4a-xxxx-xxxxxxxxxxxx' \
  --header 'content-type: application/json' \
  --header 'X-API-Version: 2025-01-01.orion' \
  --data-raw '{
    ...
    "docv": {
      "config": {
        "send_message": false,
        ...
      }
    }
  }'
```

Use the `url` field value returned in the `/api/evaluation` response to redirect the consumer to their mobile device's browser.
