Steps for integrating Finswich Checkout via Flutter
Visit the link to the flutter package
On the flutter package website they click the installing tab
Please follow the instructions on the page.
After installing and adding the finswich package to your code, here is a sample dart code to complete your set up
import 'package:finswich_checkout/finswich_checkout.dart';
import 'package:flutter/widgets.dart';
class MyWidget extends StatefulWidget {
const MyWidget({super.key});
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
bool isCheckoutVisible = false;
//to pop out the checkout set isCheckoutVisible to true
@override
Widget build(BuildContext context) {
return Stack(
children: [
Container(),//the container should be replaced by your code
/// Your widget should go here in place of container (your application)
ischeckoutvisible
? FinswichIframe(
balance: "your_user_balance",
isCheckoutVisible: isCheckoutVisible,
origin: "your_apps_origin",
///To get your origin use this [window.location.origin],
publicKey:
"your_finswich_live_public_key",
reference: "your_user_reference",
refreshUI: () {
setState(() {});
},
)
: const SizedBox(),
],
);
}
}
The table below helps to explain the objects passed to the inline JS during initialiazation
Key
Description
Type
reference
This is your user's reference on your platform
String
public_key
Your live public key from Finswich app
String
balance
the user's balance on your app
Number
origin
your whitelisted IP saved on the Finswich platform
String
PreviousIntegrating the Finswich Checkout on your Vanilla Javascript appNextPseudocode for Integrating Finswich Checkout in Application (Native iOS & Android)
Last updated