b24_direct_debit_sdk 1.0.0-beta.13 b24_direct_debit_sdk: ^1.0.0-beta.13 copied to clipboard
The Bill24 SDK simplifies setting up direct debit payments with banks. With this tool, consumers can subscribe for automatic payments.
import 'package:b24_direct_debit_sdk/b24_direct_debit_sdk.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Init SDK Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHome(),
);
}
}
// ignore: must_be_immutable
class MyHome extends StatefulWidget {
const MyHome({super.key});
@override
State<MyHome> createState() => _MyHomeState();
}
class _MyHomeState extends State<MyHome> {
final _subscriptionNoController = TextEditingController();
final _refererKeyController = TextEditingController();
final _languageCodeController = TextEditingController(text: 'km');
bool isDarkmode = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(
height: 80,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
height: 50,
child: TextFormField(
controller: _subscriptionNoController,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () async {
pastText(_subscriptionNoController);
},
icon: const Icon(Icons.paste_outlined)),
label: const Text('Subscription No'),
border: const OutlineInputBorder()),
),
),
const SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
height: 50,
child: TextFormField(
controller: _refererKeyController,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () async {
pastText(_refererKeyController);
},
icon: const Icon(Icons.paste_outlined)),
label: const Text('Referer Key'),
border: const OutlineInputBorder()),
),
),
const SizedBox(
height: 10,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 20),
height: 50,
child: TextFormField(
controller: _languageCodeController,
decoration: InputDecoration(
suffixIcon: IconButton(
onPressed: () async {
pastText(_languageCodeController);
},
icon: const Icon(Icons.paste_outlined)),
label: const Text('Language Code'),
border: const OutlineInputBorder()),
),
),
const SizedBox(
height: 10,
),
Row(
mainAxisSize: MainAxisSize.min,
children: [
Checkbox(
value: isDarkmode,
onChanged: (value) {
setState(() {
isDarkmode = value!;
});
}),
const Text("DarkMode")
],
),
ElevatedButton(
style: const ButtonStyle(
padding: WidgetStatePropertyAll(EdgeInsets.all(20)),
backgroundColor: WidgetStatePropertyAll(Colors.blue)),
onPressed: () {
if (_subscriptionNoController.text.isEmpty) {
_subscriptionNoController.text = '5KO9B8O52R1k';
}
if (_refererKeyController.text.isEmpty) {
_refererKeyController.text =
'd945botz-dc54-483d-9759-f9858a9211a0';
}
B24DirectDebitSdk.initSdk(
context: context,
subscriptionNo: _subscriptionNoController.text,
refererKey: _refererKeyController.text,
isDarkMode: isDarkmode, // optional default false
language:
_languageCodeController.text, // optional default km
isProduction: false, // optional default false (=Demo env)
isPopup: true,
testingEnv:
'Stag' // (Stag,Pilot,Demo) optional default Demo
);
},
child: const Text(
"Init SDK",
style: TextStyle(color: Colors.white),
))
],
),
);
}
}
void pastText(TextEditingController controller) async {
ClipboardData? data = await Clipboard.getData('text/plain');
if (data != null) {
controller.text = data.text ?? "";
}
}