Introduction

This Flutter SDK provides an interface to load Aerosync-UI in Flutter apps through flutter_inappwebview. 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.

1. Installation

  1. First add aerosync_flutter_sdk as a dependency to the pubspec.yaml file. We are currently on constant development for fine-tuning and improvement currently using the ^1.3.1 as our release with the most up to date features and fixes.
dependencies:
  aerosync_flutter_sdk: ^1.3.1
  1. Import the library
  import 'package:aerosync_flutter_sdk/aerosync_flutter_sdk.dart';

2. Usage/Examples

The AeroSync SDK is launched as a new page in your application. The AerosyncSDKPage widget handles the platform-specific implementation automatically.

In this example, the widget is launched by pushing a new MaterialPageRoute when an ElevatedButton is pressed.

import 'package.flutter/material.dart';
import 'package:aerosync_flutter_sdk/aerosync_flutter_sdk.dart';
import 'dart:convert';

class MyApp extends StatelessWidget {
  // Your app's state and build method
  // ...
}

class MyFeature extends StatefulWidget {
  @override
  _MyFeatureState createState() => _MyFeatureState();
}

class _MyFeatureState extends State<MyFeature> {
  final String _token = "YOUR_AEROSYNC_TOKEN"; // Replace with a valid token
  final String _env = "sandbox";
  final String? _deeplink = "myapp://connect"; // Required for mobile, can be null for web-only apps

  void handleSuccess(EventType type, dynamic data) {
    // The data is a JSON string, so we decode it.
    final successData = jsonDecode(data);
    print("AeroSync Success: ${successData['payload']}");
    // Example: Store user_id and user_password
  }

  void handleClose(EventType type, dynamic data) {
    print("AeroSync Closed");
  }
  
  void handleError(EventType type, dynamic data) {
    print("AeroSync Error: $data");
  }

  void handleEvent(EventType type, dynamic data) {
    print("AeroSync Event: $data");
  }
  
  void handleLoad(EventType type, dynamic data) {
    print("AeroSync Loaded: $data");
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: ElevatedButton(
        onPressed: () {
          Navigator.of(context).push(
            MaterialPageRoute(
              builder: (context) => AerosyncSDKPage(
                env: _env,
                token: _token,
                deeplink: _deeplink,
                style: const {"width": "378", "height": "688", "bgColor": "#FFFFFFFF"}, // Optional parameter - all properties (width, height, bgColor) have defaults if omitted
                theme: 'dark',
                onSuccess: handleSuccess,
                onClose: handleClose,
                onError: handleError,
                onEvent: handleEvent,
                onLoad: handleLoad,
              ),
            ),
          );
        },
        child: const Text('Connect Bank Account'),
      ),
    );
  }
}

The AerosyncSDKPage widget takes in parameters to configure its behavior and callbacks to handle events from the AeroSync UI. To generate a token, check out our integration guide.

Parameter Type Description
env string Required. Available values: "sandbox", "production".
token string Required. The token generated from the integration guide.
style Map? Optional styling configuration for the widget container. Default: {}
All properties are optional with defaults:
width: Widget width as string (default: "350", max: 375)
height: Widget height as string (default: "688", max: 688)
bgColor: Background color in ARGB hex format (default: "#FF949494" gray)
Example: {"width": "375", "height": "688", "bgColor": "#FFFF0000"} (red background)
theme string UI theme for the widget. Available values: 'light', 'dark'. Default: 'light'.
onEvent function(response) Required. Triggered for various events as the user navigates the workflow.
onLoad function(response) Required. Called once after the web contents have been initially loaded.
onSuccess function(response) Required. Triggered when a bank is linked successfully and the user clicks the final "Continue" button.
onClose function(response) Required. This method will be triggered when the Aerosync widget is closed.
onError function(response) Required. Called if the AeroSync UI dispatches any error events.
deeplink string? Required Only for Mobile integration Deeplink from your app.
consumerId string? Unique ID that represents the client to apply the customization. Contact the team for more information."
handleMFA bool? Boolean value that determines MFA widget invocation. Contact the team for more information."
jobId string? Unique ID that represents the current MFA jobId. Contact the team for more information."
userId string? Unique ID that represents the current MFA userId. Contact the team for more information."

Store connected account

Store onSuccess() data attributes to authenticate with the AeroSync API. The data value returned from the success callback is a JSON-encoded string. You can decode it using jsonDecode(data) to use it as a Map.

{
  "type": "pageSuccess",
  "payload": {
    "user_id": "40a8b0b79cd742bc8a4384ddfc9244c0",
    "user_password": "5e48cbb437de492992e0ebf854a8a404",
    "ClientName": "Aeropay",
    "FILoginAcctId": 113786059
  }
}