# Onboarding (KYC/KYB)

## Getting started

This guide explains how to integrate the Footprint onboarding flow for KYC (Know Your Customer) and KYB (Know Your Business) into your iOS applications. You can find the installation instructions in the [previous section](/articles/sdks/swift-introduction#footprint-for-swift-package-overview-installation).

**Note:** Make sure you have version `1.3.4` or higher installed for the onboarding integration to work properly.

1. **Create an onboarding session token**:
   * Obtain onboarding session token, e.g., `obtok_UxM6Vbvk2Rcy1gzcSuXgk3sj3L9I0pAnNH`. Read [this article](/articles/guide/definitive-integration-guide#the-end-to-end-integration-step-3-create-an-onboarding-session-token).

2. **Initialize the Footprint Flow**:
   * Trigger Footprint, for example, when a button is clicked. Then, pass the `onboardingSessionToken` and `onComplete` callback to the `initialize` method.

```swift
Button(action: {
    Onboarding.shared.initialize(
        onboardingSessionToken: "YOUR AUTH TOKEN",
        onComplete: { vTok in
            print("Onboarding complete - validation token \(vTok)")
        }
    )
}) {
    Text("Launch Footprint onboarding")
        .frame(maxWidth: .infinity)
}
```

3. **Handle Completion:**

* Once the user completes the flow, you'll receive the validationToken through the `onComplete` callback. Post this token to your backend for further processing.

## Listening to events

Footprint provides several events based on actions performed by the user. To listen to events, pass them from the `initialize` method.

```swift
Button(action: {
    Onboarding.shared.initialize(
        onboardingSessionToken: "YOUR AUTH TOKEN",
        onComplete: { vTok in
            print("Onboarding complete - validation token \(vTok)")
        },
        onCancel: {
            print("User canceled the flow")
        },
        onError: { error in
            print("Error occurred \(error.message)")
        }
    )
}) {
    Text("Launch Footprint onboarding")
        .frame(maxWidth: .infinity)
}
```

## Setting a custom appearance

You can customize the appearance of the onboarding flow by passing an `appearance` object to the `initialize` method.

```kotlin
Button(action: {
    Onboarding.shared.initialize(
        onboardingSessionToken: "YOUR AUTH TOKEN",
        onComplete: { vTok in
            print("Onboarding complete - validation token \(vTok)")
        },
        onCancel: {
            print("User canceled the flow")
        },
        onError: { error in
            print("Error occurred \(error.message)")
        },
        appearance: FootprintAppearance(
            fontSrc: nil,
            rules: nil,
            variables: FootprintAppearanceVariables.createAppearanceVariables(
                borderRadius: "8px",
                colorError: "#E33D19",
                colorSuccess: "#315E4C",
                buttonPrimaryBg: "#315E4C"
            )
        )
    )
}) {
    Text("Launch Footprint onboarding")
        .frame(maxWidth: .infinity)
}
```

For more information, including a list of available variables, check out the [customization guide](/articles/integrate/customization).

## Available Props

| Variable                 | Description                                                                                                                                                                                                       |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `onboardingSessionToken` | The onboarding session token you created.                                                                                                                                                                         |
| `onComplete`             | Optional. Triggered after the user completes the onboarding flow. You'll receive a `validationToken` that your backend can exchange with Footprint to see the `fp_id`, the login method used, and the KYC status. |
| `onError`                | Optional. A function that is called when there was an unrecoverable error during the onboarding flow.                                                                                                             |
| `onCancel`               | Optional. Triggered when the user abandons the flow.                                                                                                                                                              |
| `appearance`             | Optional. A `FootprintAppearance` object that customizes the look of your integration.                                                                                                                            |
| `l10n`                   | Optional. Specifies the desired localization using a `FootprintL10n` object. More information [here](/articles/integrate/customization#localization-configuration).                                               |