> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/integration-options/mobile/products/biometric-kyc.md).

# Biometric KYC

Biometric KYC is exposed as a flow which performs the following high level steps:

1. Displays instructions to the user
2. Requests camera permissions (if not already granted)
3. Captures and saves Liveness and Selfie images
   1. useStrictMode defaults to false and will use Smile Smartselfie™ capture screens for selfie
   2. If useStrictMode is set to true the selfie capture use Enhanced SmartSelfie™ capture
4. Submits the job to the Smile ID API
5. Delivers the result back to the caller

#### Consent Information

Some ID Types may require consent to be granted. In such cases the consent information would expect the below so this is completely optional and the SDK will default to false and consent time will be the time of execution

```
consentGrantedDate. // The date consent was granted defaults to the time of screen initialisation
personalDetailsConsentGranted // If the user has granted personal details consent defaults to false
contactInfoConsentGranted // If the user has granted contact information consent defaults to false
documentInfoConsentGranted // If the user has granted document information consent defaults to false
```

{% hint style="info" %}
If the user has granted consent personalDetailsConsentGranted, contactInfoConsentGranted, documentInfoConsentGranted can all be set to true
{% endhint %}

{% hint style="danger" %}
Java has no named parameters so when using fragments instantiate the consent with the consent grant date in iSO format and all other values set to false.
{% endhint %}

{% tabs %}
{% tab title="Jetpack Compose (Android)" %}

```kotlin
@Composable
fun BiometricKYCExample(idInfo: IdInfo) {
    SmileID.BiometricKYC(
        idInfo = idInfo,
        consentInformation = ConsentInformation(
            consented = ConsentedInformation(
                consentGrantedDate = getCurrentIsoTimestamp(), // date in iso string format for when user granted consent
                personalDetails = false, // set true if user has agreed to personal details, will default to false
                contactInformation = false, // set true if user has agreed to contact information, will default to false
                documentInformation = false, // set true if user has agreed to document information, will default to false
            ),
        ),
        useStrictMode = true, // true if you want to capture using enhanced SmartSelfie™ capture
        onResult = { result ->
            when (result) {
                is Success -> {
                    // val resultData = result.data
                    // Log.d("BiometricKYC", "Success: $resultData")
                    // ...
                }

                is Error -> {
                    // There was an error (could be denied camera permissions, network errors, etc)
                    // val throwable = result.throwable
                    // Log.w("BiometricKYC", "Failure: $it", throwable)
                }
            }
        },
    )
}
```

{% endtab %}

{% tab title="Fragment (Android)" %}

```java
IdInfo idInfo = new IdInfo(...);
BiometricKYCFragment biometricKycFragment = BiometricKYCFragment
    .newInstance(idInfo);
getSupportFragmentManager().setFragmentResultListener(
    BiometricKYCFragment.KEY_REQUEST,
    this,
    (requestKey, result) -> {
        SmileIDResult<BiometricKYCResult> biometricKycResult =
            BiometricKYCResult.resultFromBundle(result);
        Timber.v("BiometricKYC Result: %s", biometricKycResult);
        getSupportFragmentManager()
            .beginTransaction()
            .remove(biometricKycFragment)
            .commit();
        hideProductFragment();
    }
);
```

{% endtab %}

{% tab title="Swift UI (iOS)" %}

```swift
import SwiftUI
import SmileID

struct MyView: View, BiometricKycResultDelegate {
    @State private var idInfo: IdInfo
    var body: some View {
        ZStack {
            SmileID.biometricKycScreen(
                idInfo: idInfo,
                useStrictMode: true, // true if you want to capture using enhanced SmartSelfie™ capture
                consentInformation: ConsentInformation(
                    consented: ConsentedInformation(
                        consentGrantedDate: "date consent granted", // date in iso string format for when user granted consent
                        personalDetails: false, // set true if user has agreed to personal details, will default to false
                        contactInformation: false, // set true if user has agreed to contact information, will default to false
                        documentInformation: false // set true if user has agreed to document information, will default to false
                    )
                ),
                delegate: self
            )
        }
    }
    
    func didSucceed(selfieImage: URL, livenessImages: [URL], didSubmitBiometricJob: Bool) {
        print("Successfully submitted Biometric KYC job")
    }
    
    func didError(error: Error) {
        print("An error occurred - \(error.localizedDescription)")
    }
}
```

{% endtab %}

{% tab title="UIKit (iOS)" %}

```swift
let biometricKycScreen = SmileID.biometricKycScreen(...)
let controller = UIHostingController(rootView: biometricKycScreen)
controller.modalPresentationStyle = .fullScreen
navigationController?.present(controller, animated: true)
```

{% endtab %}

{% tab title="Flutter" %}

```dart
Navigator.of(context).push( //Requires Navigator.of(context).push in order to load
    MaterialPageRoute<void>(
        builder: (BuildContext context) => Scaffold(
            appBar: AppBar(title: const Text("SmileID Biometric KYC")),
            body: SmileIDBiometricKYC(
                country: "KE",
                idType: "NATIONAL_ID",
                idNumber: "12345678",
                showInstructions: true, //Show the instruction screen
                useStrictMode: true, // true if you want to capture using enhanced SmartSelfie™ capture (will invalidate the above)
                consentGrantedDate: DateTime.now().toIso8601String(), // date in iso string format for when user granted consent
                personalDetailsConsentGranted: false, // set true if user has agreed to personal details, will default to false
                contactInformationConsentGranted: false, // set true if user has agreed to contact information, will default to false
                documentInformationConsentGranted: false, // set true if user has agreed to document information, will default to false
                onSuccess: (String? result) {
                    // Your success handling logic
                    final snackBar = SnackBar(content: Text("Success: $result"));
                    ScaffoldMessenger.of(context).showSnackBar(snackBar);
                    Navigator.of(context).pop(); //Return flow to your app
                },
                onError: (String errorMessage) {
                    // Your error handling logic
                    final snackBar = SnackBar(content: Text("Error: $errorMessage"));
                    ScaffoldMessenger.of(context).showSnackBar(snackBar);
                    Navigator.of(context).pop(); //Return flow to your app
                },
            ),
        ),
    ),
);
```

On success, you will receive a JSON string following the structure:

```json
{
  "selfieFile": "<path to selfie file>",
  "livenessFiles": [
    "<path to liveness file>",
        ...
    "<path to liveness file>",
  ],
  "didSubmitBiometricKycJob": true | false
}
```

{% endtab %}

{% tab title="React Native" %}
{% hint style="info" %}
:warning: **Note:** Recommend wrapping this in a component that can be navigated to and out of view due to a known issue with views displaying dialogs particularly on failure and the dialog keeps showing,
{% endhint %}

```tsx
<SmileIDBiometricKYCView
  allowAgentMode={false}
  forceAgentMode={false}
  allowGalleryUpload={false}
  captureBothSides={true}
  showInstructions={true}
  useStrictMode={true}
  idInfo={{
    country: "<country code>",
    idType: "<id type>",
    idNumber: "<id number>",
    entered: true,
  }}
  consentInformation={{
    consentGrantedDate: new Date().toISOString(),
    personalDetails: true,
    contactInformation: true,
    documentInformation: true,
  }}
  style={{ width: '100%', height: '100%' }}
  onResult={(event) => {
    setResult(event.nativeEvent.result);
  }}
/>
```

On onResult, you will receive a JSON string following the structure:

```json
{
  "selfieFile": "<path to selfie file>",
  "livenessFiles": [
    "<path to liveness file>",
    "<path to liveness file>",
    ...
    "<path to liveness file>",
  ],
  "didSubmitBiometricKycJob": true
}
```

{% endtab %}

{% tab title="React Native Expo" %}
{% hint style="info" %}
:warning: **Note:** Recommend wrapping this in a component that can be navigated to and out of view due to a known issue with views displaying dialogs particularly on failure and the dialog keeps showing,
{% endhint %}

Begin by defining a Biometric KYC parameters object:

```typescript
import { BiometricKYCParams } from 'react-native-expo';


const biometricKYCParams: BiometricKYCParams = {
  // userId: 'user123', // Optional user ID
  // jobId: 'job456', // Optional job ID
  allowNewEnroll: false,
  allowAgentMode: true,
  showAttribution: true,
  showInstructions: true,
  skipApiSubmission: false,
  useStrictMode: false,
  extraPartnerParams: {
    'custom_param_1': 'value1',
    'custom_param_2': 'value2'
    },
  consentInformation: consentInformationParams, // Optional consent information
  idInfo: idInfoParams
};
```

Integrate the Biometric KYC component into your view by rendering the `SmileIDBiometricKYCView` and passing in the configured parameters:

```typescript
<SmileIDBiometricKYCView
    style={styles.nativeView}
    params={biometricKYCParams}
    onResult={handleSuccessResult}
    onError={handleError}
/>
```

On onResult, you will receive a JSON string following the structure:

```json
{
  "selfieFile": "<path to selfie file>",
  "livenessFiles": [
    "<path to liveness file>",
        ...
    "<path to liveness file>",
  ],
  "didSubmitBiometricKycJob": true | false
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/integration-options/mobile/products/biometric-kyc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
