Skip to content

Moov.js

Moov.js is a browser-side JavaScript library used to securely and privately capture personally identifiable information to create Organizations, Customers, and Accounts.

Play around with our interactive demo of Moov.js to see everything that it can do. Copy and paste code into your project to get up and running faster.

Including Moov.js link

Include the following script include on your page. It should always be loaded directly from https://js.moov.io rather than included in a bundle or hosted by you.

1
<script src="https://js.moov.io/v0/"></script>

Initializing Moov.js link

Use Moov() to create the Moov object, which gives you access to the rest of the Moov.js SDK.

1
const moov = Moov('your token here');

Generate a token link

Within your server-side application, you’ll generate a single-use token that contains information needed to communicate with your Moov account (and make sure no one else can). This token contains:

Claim Description
iat Issued timestamp
aud Audiences. Whitelisted endpoints that this token is allowed to access.
exp Expiry time
org Organization ID
Secret key
Public key

Once you’ve generated this token, you’ll send it back to your application in such a way that the embedded Moov.js script can access it.

Collecting PII data link

You can collect all of the user and account information in a single step. Set up a standard HTML form with the required fields and send those to Moov when the form is submitted.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<form id="form">
  <label>
    First name
    <input type="text" autocomplete="given-name" name="firstName" required>
  </label>
  <label>
    Last name
    <input type="text" autocomplete="family-name" name="lastName" required>
  </label>
  <label>
    Email
    <input type="email" autocomplete="email" name="email" required>
  </label>
  <label>
    Social security number
    <input type="text" inputmode="numeric" name="ssn" required>
  </label>
  <!-- etc etc etc -->
  <button type="submit">Submit</button>
</form>

<script>
  const moov = Moov('your token here');

  form.addEventListener('submit', (event) => {
    event.preventDefault();
    const customer = {
      firstName: form.firstName,
      lastName: form.lastName,
      email: form.email,
      ssn: form.ssn,
      type: 'individual',
      addresses: [
        {
          type: 'primary',
          street1: form.street1,
          street2: form.street2,
          city: form.city,
          state: form.state, /* two digit */
          postalCode: form.postalCode, /* five digit */
          country: 'US' /* two digit */
        }
      ]
    };

    const account = {
      accountType: form.type, /* 'Checking' or 'Savings' */
      holderName: `${form.firstName} ${form.lastName}`,
      accountNumber: form.accountNumber,
      routingNumber: form.routingNumber
    };

    moov.customers.quickEnroll(customer, account)
      .then((res) => {
        // store the above values if you're programatically making payments
        doSomething(res.customer.customerID, res.account.accountID);
      });
  });
</script>
tip
Omit the name attribute on the HTML input fields if you’re concerned about the form being submitted without JavaScript enabled.

Articles in this section