finik_sdk 0.1.12
finik_sdk: ^0.1.12 copied to clipboard
This Flutter package allows your application to integrate Finik application features.
Finik SDK #
Overview #
The Finik SDK is a Flutter package that helps your app retrieve QR codes from the Finik server.
It also includes a pre-made QR page for easy and fast integration into your app.
Platform | Android | iOS | Linux | macOS | Web | Windows |
---|---|---|---|---|---|---|
Support | SDK 19+ | 12.0+ | - | - | - | - |
Features #
1. Fetch QR Codes from the Server #
Easily get or create QR codes using Finik SDK. The SDK uses GraphQL queries for accurate and updated data.
2. Pre-Made QR Page #
Quickly add a ready-to-use QR page to your app to save development time.
How to Use #
Example Code #
Here’s how to use FinikProvider to add the SDK to your app:
import 'package:flutter/material.dart';
import 'package:finik_sdk/finik_sdk.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Finik DEMO',
home: FinikProvider(
apiKey: 'YOUR_API_KEY',
// OPTIONAL - default FinikSdkLocale.KG
locale: FinikSdkLocale.EN,
// OPTIONAL - default true
useHiveForGraphQLCache: false,
onBackPressed: () {},
onPaymentSuccess: (data) {
print('Payment succeeded: $data');
// OUTPUT example:
// payment succeeded: {accountId: b358ec49-c2f5-49b2-97ef-afc9e47efeb2, amount: 123.95, fields:
// {amount: 123.95, YOU_FIELD_ID_FOR_REQUIRED_FIELD: YOUR_VALUE}, id:
// 692910201_97ab0bec-69c5-419d-8cfa-4b7963b98b82_DEBIT, requestDate: 1737537122065, status: SUCCEEDED,
// transactionDate: 1737537124659, transactionId: 97ab0bec-69c5-419d-8cfa-4b7963b98b82, transactionType:
// DEBIT, item: {id: 3667229233_e3b98d14-ffd3-4cf8-b520-e1be9079c3f0}}
},
onPaymentFailure: (String message) {},
widget: const CreateItemHandlerWidget(
accountId: 'YOUR_ITEM_ID',
nameEn: 'YOUR_NAME_EN',
// OPTIONAL
callbackUrl: 'YOUR_CALLBACK_URL',
// OPTIONAL
fixedAmount: 123.45,
// OPTIONAL
requiredFields: [
RequiredField(
fieldId: 'YOU_FIELD_ID_FOR_REQUIRED_FIELD',
value: 'YOUR_VALUE',
),
],
// OPTIONAL - default TextScenario.replenishment
textScenario: TextScenario.payment,
),
),
);
}
}
Parameters Explained #
- apiKey: Your API key from the Finik server.
- locale: The language for translations. Supported options: 'ky', 'en', 'ru'.
- useHiveForGraphQLCache: Chooses where to store GraphQL data:
- Set to
true
for local disk storage using Hive. - Set to
false
for temporary in-memory storage (good for app runtime).
- Set to
- onBackPressed: A function triggered when the back button is pressed. Useful for
custom navigation or showing dialogs.
- widget: The
FinikWidget
managed byFinikProvider
.
- widget: The
- onPaymentSuccess: A function triggered when the payment is succeeded. Returns the payment data.
- onPaymentFailure: A function triggered when the payment is failed. Returns the error message.
FinikWidget Details #
The FinikWidget
is a basic widget used in the Finik SDK. It lets you add different functions
to your app and is passed to FinikProvider
. The SDK currently includes these widgets:
1. CreateItemHandlerWidget #
A widget for creating or managing items in the Finik system.
Parameters
accountId
(String, required): The unique ID for the account or item.nameEn
(String, required): The name of the item in English.callbackUrl
(String, optional): Callback URL for the item.requiredFields
(List: Extra fields needed to create the item. Each field includes:fieldId
(String): The unique ID for the field.value
(String): The value for the field.
fixedAmount
(double): amount of the money in the qr.textScenario
: Choose a text scenario for the widget. Default isTextScenario.replenishment
.
Example Code
CreateItemHandlerWidget(
accountId: 'YOUR_ITEM_ID',
nameEn: 'YOUR_NAME_EN',
// OPTIONAL
callbackUrl: 'YOUR_CALLBACK_URL',
// OPTIONAL
fixedAmount: 123.95,
// OPTIONAL
requiredFields: [
RequiredField(
fieldId: 'YOUR_FIELD_ID_FOR_REQUIRED_FIELD',
value: 'YOUR_VALUE',
),
],
// OPTIONAL - default TextScenario.replenishment
textScenario: TextScenario.payment,
)
2. GetItemHandlerWidget #
A widget for getting and showing information about a specific item.
Parameters
itemId
(String, required): The unique ID for the item to fetch.textScenario
: Choose a text scenario for the widget. Default isTextScenario.replenishment
.
Example Code
GetItemHandlerWidget(
itemId: 'YOUR_ACCOUNT_ID',
// OPTIONAL - default TextScenario.replenishment
textScenario: TextScenario.payment,
)
Notes #
- These widgets are used with
FinikProvider
for flexible and easy integration into your app. - More widgets may be added later to enhance the SDK's features.
Compatibility #
- Dart: Version 2.17.0 or higher
- Platforms: Android (SDK 19+), iOS (12.0+)
Contributions #
We welcome your feedback and contributions to make the Finik SDK even better.
Feel free to report issues or suggest new features!
Contact #
For questions or support, please email: hello@mancho.dev