Onboarding

Implement a pre-built user interface for onboarding individuals or businesses easily, even if they require verification.

With the moov-onboarding element, users can enter individual or business information to create an account, and Moov handles the verification process. The onboarding Drop takes care of the entire account creation workflow, with UX features to keep the information collection process as seamless as possible.

Visit our Drops 101 guide to learn the basics of properties, attributes, and initializing Drops.

Properties

Properties can be accessed through JavaScript using a reference to the moov-onboarding element.

Property Type Description
token String Auth Token used for hitting the API. See the Scopes section for more detail.
facilitatorAccountID String ID for the facilitator account. The account created through onboarding will be connected to this account.
accountData Object Partial account data used to pre-populate fields in the onboarding dialog.
capabilities String[] The capabilities requested by this account. Fields in the onboarding dialog will be marked as optional or required based on the requested capabilities.
open Boolean Whether or not the dialog is currently displayed to the user.
onResourceCreated Function Callback fired when the onboarding dialog creates a new resource (account, payment method, etc). Use this callback to update your token with the appropriate scopes before creating the next resource. See the Scopes section for more detail.
onError Function Callback fired when the onboarding dialog encounters an error.
onCancel Function Callback fired when the user attempts to close the dialog.
onSuccess Function Callback fired when the user completes the onboarding process.
plaid Object A Plaid configuration object. Used for setting up a payment method through Plaid.
onPlaidRedirect Function Callback fired after following a redirect from Plaid. Provides a restoredProperties object which can be used to restore the state of the drop.
paymentMethodTypes String[] An array of allowed payment method types. Possible values are card or bankAccount.
allowedCardBrands String[] An array of allowed card brands. If this field is not provided, all card brands will be accepted. Accepted values are visa, mastercard, american-express, diners-club, discover, jcb, unionpay, maestro, mir, elo, hiper, or hipercard.
microDeposits Boolean If false, hides the micro deposit verification step when adding a payment method. Defaults to true.

How to set a property

1
2
const onboarding = document.querySelector('moov-onboarding');
onboarding.token = 'eyjh...';
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
const onboarding = document.querySelector('moov-onboarding');
onboarding.accountData = {
  profile: {
    individual: {
      email: "john.doe@moov.io",
      name: { firstName: "John", lastName: "Doe" },
      birthDate: {
        day: 1,
        month: 1,
        year: 1990,
      },
    },
  },
};
1
2
3
4
5
const onboarding = document.querySelector('moov-onboarding');
onboarding.onError = ({ errorType, error }) => {
  console.log(errorType); // "account", "representative", "bankAccount", etc
  console.error(error); // Error message
};

Attributes

String-type properties can be set via attributes on the HTML <moov-onboarding> element.

Attribute Description
token Auth Token used for hitting the API. See the Scopes section for more detail.
facilitator-account-id ID for the facilitator account. The account created through onboarding will be connected to this account.

Scopes

The moov-onboarding Drop requires different scopes at different steps in the onboarding process.

As users move through the onboarding flow, the Drop creates new resources (accounts, payment methods, etc), and it needs the appropriate permissions to read or modify those resources. The developer is responsible for updating the onboarding token with new scopes as resources are created.

  1. Create a token with the following initial scopes:
    • accounts.write
    • accounts/{facilitatorAccountID}/profile.read
    • fed.read
    • profile-enrichment.read
  2. Initialize the onboarding Drop with the token.
    1
    2
    
    // Get `myToken` with initial scopes
    onboarding.token = myToken;
    
  3. The user enters information for their new account.
  4. The onboarding Drop creates the account and fires the onResourceCreated callback.
    1
    2
    3
    4
    
    onboarding.onResourceCreated = ({ resourceType, resource }) => {
      // This fires when the account is created
      console.log("Resource created! ", resource);
    }
    
  5. Get the account from the onResourceCreated callback:
    1
    2
    3
    4
    5
    
    onboarding.onResourceCreated = ({ resourceType, resource }) => {
      if (resourceType === "account") {
        // Save the account resource somewhere
      }
    };
    
  6. Use the account ID to create a new token and add the following scopes:
    • All initial scopes
    • /accounts/{newAccountID}/bank-accounts.read
    • /accounts/{newAccountID}/bank-accounts.write
    • /accounts/{newAccountID}/capabilities.read
    • /accounts/{newAccountID}/capabilities.write
    • /accounts/{newAccountID}/cards.read
    • /accounts/{newAccountID}/cards.write
    • /accounts/{newAccountID}/profile.read
    • /accounts/{newAccountID}/profile.write
    • /accounts/{newAccountID}/representatives.read
    • /accounts/{newAccountID}/representatives.write
  7. Update the onboarding Drop with the new token:
    1
    2
    
    // Get `myToken2` with account-related scopes
    onboarding.token = myToken2;
    
  8. The user can now continue on to add payment methods to the account.

Theming

Visit our guide on themes to learn how to re-style Moov Drops.