# Tax ID Validation

The Tax ID Validation module collects a user's tax identification number and validates its format and structure. Your Incode Flow or Workflow configuration determines what the validation checks and how the result is interpreted.

There is no Dashboard equivalent for this module, so you cannot use [integration Pattern 3](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-3-run-flows-configured-in-dashboard) to add it. You must use [Pattern 1](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-1-configure-flows-locally-and-run-end-to-end) or [2](https://developer.incode.com/docs/android-common-implementation-patterns#pattern-2-configure-flows-locally-and-run-step-by-step), adding the module to a `FlowConfig` in code as shown on this page.

{/* PM: True? No Dashboard equivalent? */}

## Add Tax ID Validation

Add the module with `addTaxIdValidation()`.

```kotlin
flowConfigBuilder.addTaxIdValidation()
```
```java
flowConfigBuilder.addTaxIdValidation();
```

### Example

The example below adds Tax ID Validation as the only step in the flow and listens for the result through `onTaxIdValidationCompleted()`.

```kotlin
val flowConfig = FlowConfig.Builder()
    .addTaxIdValidation()
    .build()

val onboardingListener = object : OnboardingListener() {
    override fun onTaxIdValidationCompleted(isSuccess: Boolean) {
        // Tax ID validation step completed. isSuccess reports whether validation succeeded.
    }
}

IncodeWelcome.getInstance()
    .startOnboarding(activityContext, sessionConfig, flowConfig, onboardingListener)
```
```java
FlowConfig flowConfig = new FlowConfig.Builder()
    .addTaxIdValidation()
    .build();

IncodeWelcome.OnboardingListener onboardingListener = new IncodeWelcome.OnboardingListener() {
    @Override
    public void onTaxIdValidationCompleted(boolean isSuccess) {
        // Tax ID validation step completed. isSuccess reports whether validation succeeded.
    }
};

IncodeWelcome.getInstance()
    .startOnboarding(activityContext, sessionConfig, flowConfig, onboardingListener);
```

## Configuration Options

Tax ID Validation has no configurable options. It is constructed with a no-argument constructor, and `addTaxIdValidation()` adds it for you.

## Result

Tax ID Validation does not deliver a result payload object through the `OnboardingListener`. Completion is signaled by the `onTaxIdValidationCompleted(boolean)` callback, where the `isSuccess` flag reports whether the tax ID validation step succeeded.

If the step fails with an error, it surfaces through `OnboardingListener.onError(Throwable)`. This module does not define a module-specific exception subtype.

For the related listener interface, see `TaxIdValidationListener` in [API Reference](https://developer.incode.com/docs/android-api-reference).
