kudaopenapi 0.0.6 copy "kudaopenapi: ^0.0.6" to clipboard
kudaopenapi: ^0.0.6 copied to clipboard

Kudaopenapi is a library to allow communication with Kuda Bank API to setup your own fintech apps .

KudaOpenAPI Integration in Flutter

KudaOpenAPI for flutter for seemless banking via Kudaopenapi.


Getting Started   |   Installation   |   Usage   |   License   |   Author


🎯 Getting Started #

Enable your product for local transactions with the KudaOpenAPI! With the KUDA Open APIs you can embed services unto your platform and connect your customers to a wide range of banking services.

Before you proceed, ensure you have a Kuda Business account!. You can link this account to your profile to get approved for live.

Get your token from the Developer Dashboard!.

🎯 Installation #

To use this plugin, add kudaopenapi as a dependency in your pubspec.yaml file.

Then initialize the plugin preferably in the initState of your widget.

import 'package:kudaopenapi/kudaopenapi.dart';

class _MyHomePageState extends State<MyHomePage> {
	var baseurl = 'TEST_OR_LIVE_URL';
	var email = 'EMAIL';
	var apikey = 'APIKEY';
	@override
	void initState() {
		ApiService.initialize(baseurl, email, apikey);
		super.initState();
	}
}

No other configuration required—the plugin works out of the box.

✨ Usage #

Make Request to the API using this

String trackingReference = Random().nextInt(100000).toString();

Map<String, dynamic> data = {
  'ClientAccountNumber': "00000000000",
  'beneficiarybankCode': "000014",
  'beneficiaryAccount': "000000000000",
  'beneficiaryName': "GIFT IWOKURA BALOGUN",
  'amount': "5000",
  'narration': "Payment Flutter",
  'nameEnquirySessionID': "00000000000000000",
  'trackingReference': Random().nextInt(100000).toString(),
  'senderName': "Gift Balogun",
}; //Format for sending data through

String requestRef = Random().nextInt(100000).toString();

To get the list of banks with the kudaopenapi

import 'package:kudaopenapi/kudaopenapi.dart';

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
        appBar: AppBar(title: const Text("Kuda Get Bank API")),
        body: FutureBuilder<BankResponse>(
          future: KudaBank().getBankList(requestRef),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              return ListView.builder(
                itemCount: snapshot.data!.data!.data!.length,
                itemBuilder: (context, index) {
                  return ListTile(
                    leading: const Icon(Icons.list),
                    trailing: Text(
                      snapshot.data!.data!.data![index].bankCode.toString(),
                      style: TextStyle(color: Colors.green, fontSize: 15),
                    ),
                    title: Text(
                      snapshot.data!.data!.data![index].bankName.toString(),
                    ),
                  );
                },
              );
            } else if (snapshot.hasError) {
              return Text(snapshot.error.toString());
            }
            return CircularProgressIndicator();
          },
        )
      ),
  );
}

To get the details of an account

import 'package:kudaopenapi/kudaopenapi.dart';

class _MyHomePageState extends State<MyHomePage> {
  var baseurl = '';
  var email = '';
  var apikey = '';

  @override
  void initState() {
    ApiService.initialize(baseurl, email, apikey);
    super.initState();
  }

  String trackingReference = Random().nextInt(100000).toString();

  // Set the request data
  Map<String, dynamic> data = {
    'beneficiaryAccountNumber': '1413800836',
    'beneficiaryBankCode': '000014',
    'SenderTrackingReference': '',
    'isRequestFromVirtualAccount': true,
  };

  String requestRef = Random().nextInt(100000).toString();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Kuda Name Inquiry API")),
      body: Center(
        child: FutureBuilder(
          future: KudaBank().name_inquiry(data, requestRef),
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            if (snapshot.connectionState == ConnectionState.done) {
              if (snapshot.hasError) {
                return Text('Error: ${snapshot.error}');
              } else {
                var something = snapshot.data.data!;
                return Text('sessionID: ${something.nameInquiry!.sessionID}');
              }
            } else {
              return CircularProgressIndicator();
            }
          },
        ),
      ),
    );
  }
}

To get retrieve virtual account details with the kudaopenapi

import 'package:kudaopenapi/kudaopenapi.dart';

@override
Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("KudaOpenApi-Retrieve")),
        body: Center(
          child: Column(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
            FutureBuilder(
              future: KudaBank().retrieve_virtual_account(data, requestRef),
              builder: (BuildContext context, AsyncSnapshot snapshot) {
                if (snapshot.connectionState == ConnectionState.done) {
                  if (snapshot.hasError) {
                    return Text('Error: ${snapshot.error}');
                  } else {
                    var something = snapshot.data.data!;
                    return Column(
                      children: [
                        Text('AccountNumber: ${something!.rvirtualAccount!.accountnumber!}'),
                        Text('Email.: ${something!.rvirtualAccount!.email}'),
                        Text('Phone Number.: ${something!.rvirtualAccount!.phonenumber}'),
                        Text('AccountName.: ${something!.rvirtualAccount!.accountname}'),
                        Text('Fullname.: ${something!.rvirtualAccount!.firstname}'),
                        Text('Tracking Ref.: ${something!.rvirtualAccount!.trackingref}'),
                      ],
                    );
                  }
                } else {
                  return CircularProgressIndicator();
                }
              },
            ),
          ]
        ),
      ),
    );
  }
}

📝 License #

This project is under license from MIT. For more details, see the LICENSE file.

Social Presense #

Follow me on social media Medium! Twitter! Instagram! LinkedIn! Porfolio!

Back to top

2
likes
0
pub points
0%
popularity

Publisher

verified publishergiftbalogun.name.ng

Kudaopenapi is a library to allow communication with Kuda Bank API to setup your own fintech apps .

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, get, http

More

Packages that depend on kudaopenapi