3 min read

Launch your Footprint onboarding flow from your Expo app. Your playbook defines the data to collect, checks to run, and outcome. Install the SDK before you start.

Start an onboarding

  1. Create an onboarding session. Call POST /onboardings and keep the onboarding session token it returns, such as obtok_xxx.
  2. Launch the flow. When the user taps a button, for example, call onboarding.initialize with the onboardingSessionToken and an onComplete callback.
javascript
1import { onboarding } from "@onefootprint/footprint-expo";
2import { View, Button } from "react-native";
3
4const App = () => {
5    const launch = () => {
6        onboarding.initialize({
7            onboardingSessionToken: "obtok_xxx",
8            onComplete: ({ onboardingId }) => {
9                console.log(onboardingId);
10            },
11        });
12    };
13
14    return (
15        <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
16            <Button onPress={launch} title="Launch Footprint" />
17        </View>
18    );
19};

Handle the result

When the user completes the flow, onComplete receives { validationToken, onboardingId }. Send the onboardingId to your backend and read the result with GET /onboardings/{id}. The ID comes from the device, so check that it matches the id your backend got from POST /onboardings for this user before you act on the result. validationToken is deprecated and will be removed, so use onboardingId when possible.

The SDK also reports errors, cancellation, and closing. Pass onError, onCancel, and onClose to initialize:

typescript
1onboarding.initialize({
2  onboardingSessionToken: "obtok_xxx",
3  onComplete: ({ onboardingId }) => {
4    console.log(onboardingId);
5  },
6  onError: (error) => {
7    console.log(error);
8  },
9  onCancel: () => {
10    console.log("User canceled the flow");
11  },
12  onClose: () => {
13    console.log("User closed the flow");
14  },
15});

Customize the appearance

Pass an appearance object to initialize to change the look of the flow:

typescript
1onboarding.initialize({
2  onboardingSessionToken: "obtok_xxx",
3  onComplete: ({ onboardingId }) => {
4    console.log(onboardingId);
5  },
6  appearance: {
7    variables: {
8      borderRadius: "8px",
9      colorSuccess: "#10b981",
10      colorError: "#F87171",
11      buttonPrimaryBg: "#5550e9",
12    },
13  },
14});

The customization guide lists every variable.

Available props

Variable Description
onboardingSessionToken The onboarding session token you created.
onComplete Triggered after the user completes the onboarding flow. You receive { validationToken, onboardingId }. Read the result with GET /onboardings/{onboardingId}.
onError Optional. Called when there was an unrecoverable error while initializing the onboarding flow. It receives an error string with more details.
onCancel Triggered when the user abandons the flow, for example by tapping the close button inside the in-app browser.
onClose Triggered when the user closes the flow, whether completed or canceled.
appearance Optional. A FootprintAppearance object that customizes the look of your integration.
l10n Optional. The desired localization. See Localization configuration.

Next steps