Code Monkey home page Code Monkey logo

mono-flutter's Introduction

mono_flutter

pub package

A Flutter plugin integrating the official android and ios SDK for Mono (financial data Platform) (https://mono.co/)

Mono Connect.js is a quick and secure way to link bank accounts to Mono from within your app. Mono Connect is a drop-in framework that handles connecting a financial institution to your app (credential validation, multi-factor authentication, error handling, etc). It works on mobile and web.

For accessing customer accounts and interacting with Mono's API (Identity, Transactions, Income, DirectPay) use the server-side Mono API For complete information about Mono Connect, head to the docs. https://docs.mono.co/docs/ .

Getting Started

Register on the Mono website and get your public and secret keys. Setup a server to exchange tokens to access user financial data with your Mono secret key.

Screenshot Screenshot

Web Screenshot

Web Screenshot

Preview

you can checkout a web preview here https://wiseminds.github.io/mono-flutter

Usage

Import package:mono_flutter/mono_flutter.dart and use the methods in MonoFlutter class.

for web support ass the following to index.html :

<script src="https://connect.withmono.com/connect.js"></script>
 <script>
   function setupMonoConnect(key, reference, config) {
     const options = {
       key,
        reference,
       onSuccess: onSuccess,
       onEvent: onEvent,
       onClose: onClose,
       onLoad: onLoad
     };
     const MonoConnect = new Connect(options);
     const configJson = JSON.parse(config ?? `{}`);

     MonoConnect.setup(configJson);

      if(authCode && String(authCode).length > 0) {
       MonoConnect.reauthorise(authCode);
     }

     MonoConnect.open()
     
   }
 </script>

Example:

import 'package:mono_flutter/mono_flutter.dart';

void main() async {
    runApp(App());
}

class App extends StatelessWidget {

    @override
    Widget build(BuildContext context) {
        return  Center(
          child: RaisedButton(
        child: Text('launch mono'),
        onPressed: () {
          MonoFlutter().launch(
              context,
              'YOUR_PUBLIC_KEY_HERE',
              // authCode: 'code_sGjE1Zh48lFR8vr3FkrD',
              reference: DateTime.now().millisecondsSinceEpoch.toString(),
              config: jsonEncode({
                "selectedInstitution": {
                  "id": "5f2d08bf60b92e2888287703",
                  "auth_method": "internet_banking"
                }
              }),
              onEvent: (event, data) {
                print('event: $event, data: $data');
              },
              onClosed: () {
                print('Modal closed');
              },
              onLoad: () {
                print('Mono loaded successfully');
              },
              onSuccess: (code) {
                print('Mono Success $code');
              },
            );
    }
}

checkout the example project for full implementation

###Reauthorization Passing the [authCode] to the launch command This package will automatically call [connect.reauthorise(authCode)]

  connect.reauthorise(authCode);

Reauth code is a mono generated code for the account you want to re-authenticate, which must be requested by your server and sent to your frontend where you can pass it to mono connect widget. Mono connect widget will ask for the required information and re-authenticate the user's account and notify your server. Once the reauthorisation is complete, the mono.events.account_reauthorized event will be sent to your webhook, following with mono. events. account_updated once the synced data is available.

Customizations

for a custom page or with a dialog, use the [MonoFlutterWebView] widget, but this is not supported on the web

 showDialog(context: context, builder: (c)=>  MonoWebView(
                    apiKey: 'test_pk_qtys19MqGkmrkGk9RDjc',
                    config: {
                      "selectedInstitution": {
                        "id": "5f2d08bf60b92e2888287703",
                        "auth_method": "internet_banking"
                      }
                    },
                    reAuthCode: reAuthCode,
                    onEvent: (event, data) {
                      print('event: $event, data: $data');
                    },
                    onClosed: () {
                      print('Modal closed');
                    },
                    onLoad: () {
                      print('Mono loaded successfully');
                    },
                    onSuccess: (code) {
                      print('Mono Success $code');
                    },
                  )));

mono-flutter's People

Contributors

wiseminds avatar peterewanfo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.