kudaopenapi

Last updated:

0 purchases

kudaopenapi Image
kudaopenapi Images
Add to Cart

Description:

kudaopenapi

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();
}
}
copied to clipboard
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();
copied to clipboard
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!.banks.length,
itemBuilder: (context, index) {
return ListTile(
leading: const Icon(Icons.list),
trailing: Text(
snapshot.data!.data!.banks[index].bankCode.toString(),
style: TextStyle(color: Colors.green, fontSize: 15),
),
title: Text(
snapshot.data!.data!.banks[index].bankName.toString(),
),
);
},
);
} else if (snapshot.hasError) {
return Text(snapshot.error.toString());
}
return CircularProgressIndicator();
},
)
),
);
}
copied to clipboard
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();
}
},
),
),
);
}
}
copied to clipboard
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();
}
},
),
]
),
),
);
}
}
copied to clipboard
To get list of GiftCards Offered by Kuda
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Gift Cards')),
body: FutureBuilder<GiftCardResponse>(
future: KudaGiftCard().list_gift_cards(requestRef),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));

} else if (!snapshot.hasData || snapshot.data!.data.giftItems.isEmpty) {
return Center(child: Text('No gift cards available'));
} else {
return ListView.builder(
itemCount: snapshot.data!.data.giftItems.length,
itemBuilder: (context, index) {
final giftCard = snapshot.data!.data.giftItems[index];
return ListTile(
leading: Image.network(giftCard.image),
title: Text(giftCard.package),
subtitle: Text('Category: ${giftCard.category}'),
trailing: Text(
'Country: ${giftCard.countries.length}',
style: TextStyle(color: Colors.red),
),
onTap: () {
// Handle gift card item tap
},
);
},
);
}
},
),
);
}
copied to clipboard
📝 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

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.