---
updatedAt: 2026-06-02T23:09:20.000Z
agentTools:
  projectIndex: https://dev.aero.inc/llms.txt
---

# Web NPM SDK (v2.0+)

Aerosync SDK for use with network user identifier: aeroPassUserUuid.

> 👍 Aeronetwork SDK: aeroPassUserUuid
>
> All new of the web npm SDK will **require an aeroPassUserUuid** in the widget configuration to render the most updated experience. The aeroPassUserUuid can be fetched from the GET /v2/user call.

> 🚧 **\[ACTION REQUIRED]** Origin URL Whitelisting
>
> Before integrating the Aerosync Web NPM SDK, **send your Aeropay Solutions Engineer your website's origin URLs** so we can whitelist them. Without whitelisting, the Aerosync widget may be blocked from loading.
>
> **What's an origin URL?** The base URL of your app/website - just the protocol and domain (no page paths).
>
> **What to send:**
>
> * All domains/subdomains where Aerosync will run
> * Include: production, sandbox, dev, localhost environments
> * Include port numbers if using custom ports
>
> Format:
>
> * `https://www.yoursite.com` ← standard
> * `https://www.yoursite.com:3000` ← if using a custom port, include it!
>
> Examples:
>
> ✅ `https://checkout.yoursite.com`
>
> ✅ `https://dev.yoursite.com`
>
> ❌ `https://localhost:3000 `(localhost URLs not required)
>
> ❌ `https://yoursite.com/checkout/payment` (too specific - remove the path)

# Introduction

This NPM package provides an interface to load Aerosync-UI in Javascript/typescript application. Securely link your bank account through your bank’s website. Log in with a fast, secure, and tokenized connection. Your information is never shared or sold.

# Creating a User

The Web+Aeronetwork SDKs require a user identifier, `aeroPassUserUuid`, to be passed to the widget on launch. Follow the guide [here](https://dev.aero.inc/docs/user-flows) to create a new user and access the user's aeroPassUserUuid.

# 1. Install Aerosync Web NPM SDK (v2.1.0+)

```javascript
npm i aerosync-web-sdk
```

# 2. Create HTML element reference

Add HTML id attribute in the page where the Aerosync widget will be launched.

```
<!--button to lauch Aerosync widget-->
  <button id="openBank" class="button" role="button" @click="openAerosyncWidget()">
    Connect Bank
  </button>
  <!--The id 'widget' allows Aerosync to access the element where the widget will be launched -->
  <div id="widget"></div>
```

# 3. Import Aerosync Web SDK

To initialize Aerosync in your app, create a widgetRef object as show below :

```
/**
 * Integrate AeroSync UI AddBank
 */
import { initAeroSyncWidget } from 'aerosync-web-sdk';

    openAerosyncWidget() {

      let token = ""; // Signature to instigate Aerosync services

      let deeplink = ""; // Unique URL that points to the specific page within the mobile app

      let configurationId = ""; // Unique ID that represents the merchant for customization. Previously consumerId.

      let handleMFA = false; // if true then handle the additional MFA workflow for balance refresh

      let jobId = ""; // Unique ID for current job (only required if handleMFA is true)

      let connectionId = ""; // Unique ID for user (only required if handleMFA is true)
      
      let aeroPassUserUuid = ""; // Aeropass user id - REQUIRED

      let widgetRef = initAeroSyncWidget({
        elementId: "widget",
        iframeTitle: 'Connect',
        environment: 'sandbox', // sandbox, production
        token: token,
        widgetLaunchType: 'host', // host, systemBrowser
        style: {
          width: '375px',
          height: '688px',
          bgColor: '#000000',
          opacity: 0.7
        },
        deeplink: deeplink,
        handleMFA: handleMFA,
        jobId: jobId,
        connectionId: connectionId,
        configurationId: configurationId,
        aeroPassUserUuid: aeroPassUserUuid,
        onEvent: function (event) {
          console.log("onEvent", event, event.type);
        },
        onLoad: function () {
          console.log("onLoad");
        },
        onSuccess: function (event) {
          console.log("onSuccess", event);
        },
        onClose: function () {
          console.log("onClose");
        },
        onError: function (event) {
          console.log("onError", event);
        }
      });

      // launch Aerosync widget with the configuration
      widgetRef.launch();
    }
```

# 4. Widget configuration

Configure your environment for sandbox (<https://www.sandbox.aerosync.com>) or production (<https://www.aerosync.com>). Additionally configure an id, iframeTitle, width, and height of the window.

| Parameter        | Type               | Required    | Description                                                                                                                                                                                                                                                                                                   |
| :--------------- | :----------------- | :---------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| token            | string             | No          | Request AeroSync Token using POST /getAggregatorCredentials endpoint.                                                                                                                                                                                                                                         |
| elementId        | string             | Yes         | Specifies a unique id for an HTML element. The default value is "widget".                                                                                                                                                                                                                                     |
| iframeTitle      | string             | Yes         | Adds title text to the iframe.                                                                                                                                                                                                                                                                                |
| width            | string             | Yes         | Specifies the width of the iframe in pixels.                                                                                                                                                                                                                                                                  |
| height           | function(response) | Yes         | Specifies the height of the iframe in pixels.                                                                                                                                                                                                                                                                 |
| environment      | string             | Yes         | Permitted values are \[sandbox, production]                                                                                                                                                                                                                                                                   |
| deeplink         | string             | Conditional | **Required for mobile applications.** Not required for web applications. <br /><br />Your app's base URL. Aerosync will redirect to this link on mobile app after authentication to resume the workflow for OAuth bank experiences  You can send the deeplink as empty string. Eg: `let deeplink:string = ""` |
| configurationId  | string             | Yes         | Unique ID assigned to you to apply widget customizations.                                                                                                                                                                                                                                                     |
| aeroPassUserUuid | string             | Yes         | Aeronetwork user id                                                                                                                                                                                                                                                                                           |
| handleMFA        | boolean            | No          | Handle the additional MFA for balance refresh workflow.                                                                                                                                                                                                                                                       |
| jobId            | string             | No          | Unique identifier for current job.                                                                                                                                                                                                                                                                            |
| connectionId     | string             | No          | Unique identifier for current user.                                                                                                                                                                                                                                                                           |

# 5. Define postMessage events

| Parameter | Type                                    | Required | Description                                                                                                                             |
| :-------- | :-------------------------------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
| onLoad    | function()                              | No       | This method will be triggered after the contents of a webpage have been loaded.                                                         |
| onSuccess | function(event: WidgetEventSuccessType) | Yes      | This method will be triggered when a bank is added successfully and the user clicks on "continue" button in the final AeroSync-UI page. |
| onError   | function(event: string)                 | Yes      | The method is called if AeroSync-UI dispatches any error events.                                                                        |
| onClose   | function()                              | Yes      | This event will be triggered if the user closes the AeroSync-UI window.                                                                 |
| onEvent   | function(event: WidgetEventType)        | No       | AeroSync-UI will trigger event on each page load.                                                                                       |

<br />

## 5.1 WidgetEventSuccessType

| Property         | Type   | Description                                         |
| :--------------- | :----- | :-------------------------------------------------- |
| connectionId     | string | The unique identifier for the Aerosync              |
| clientName       | string | The name of the client associated with the session. |
| aeroPassUserUuid | string | UUID of the authenticated AeroPass user.            |

<br />

## 5.2 WidgetEventType

| Property | Type                   | Description               |
| :------- | :--------------------- | :------------------------ |
| payload  | WidgetEventPayloadType | The payload of the event. |
| type     | string                 | The type of the event.    |

<br />

## 5.3 WidgetEventPayloadType

| Property  | Type   | Description                 |
| :-------- | :----- | :-------------------------- |
| pageTitle | string | The identifier of the page. |
| onLoadApi | string | The identifier of the API.  |