finik_sdk 2.4.1
finik_sdk: ^2.4.1 copied to clipboard
This Flutter package allows your application to integrate Finik payment feature.
Finik SDK #
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 screen widget for easy and fast integration into your app.
Platform | Android | iOS | Linux | macOS | Web | Windows |
---|---|---|---|---|---|---|
Support | SDK 19+ | 12.0+ | - | - | - | - |
π¦ Features #
- π Secure payment integration with Finik server
- π² Prebuilt payment UI using Flutter
- π‘ Built-in support for GraphQL data retrieval
- π§± Supports multiple widget types (Create/Get payment Item)
- π Multi-language support:
ky
,en
,ru
Note #
- If you are using Flutter version lower than
3.31.0-0.0.pre
, you need to override theintl
dependency.
π‘ Usage #
π² 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',
isBeta: true,
locale: FinikSdkLocale.KY,
textScenario: TextScenario.REPLENISHMENT,
paymentMethods: const [PaymentMethod.APP, PaymentMethod.QR],
enableShimmer: true,
enableShare: true,
tapableSupportButtons: true,
enableSupportButtons: true,
onBackPressed: () {
print("ExampleApp: Back pressed");
},
onPayment: (data) {
print('ExampleApp: Payment data: $data');
// Example output (data is of type Map<String, dynamic>):
// Payment Data: {accountId: test_account_id, amount: 77.95, fields: {amount: 77.77, YOU_FIELD_ID:
// YOUR_FIELD_VALUE}, id: 692910201_97ab0bec-69c5-419d-8cfa-4b7963r98b82_DEBIT, requestDate: 1737537122065,
// status: SUCCEEDED, transactionDate: 1737537124659, transactionId: 97ab0bec-69c5-419d-8cfa-4b7963b98b82,
// transactionType: DEBIT, item: {id: 3667229233_e3b98d14-ffd3-4cf8-b520-e1be9079c3f0}}
},
widget: CreateItemHandlerWidget(
accountId: 'YOUR_ACCOUNT_ID',
nameEn: 'YOUR_ITEM_NAME_EN',
requestId: '110ec58a-a0f6-4ac4-8353-c86cd813b8d1',
amount: const FixedAmount(10.0),
description: 'YOUR_DESCRIPTION',
callbackUrl: 'YOUR_CALLBACK_URL',
maxAvailableQuantity: 100,
maxAvailableAmount: 1000,
startDate: DateTime(2025, 7, 1, 0, 0),
endDate: DateTime(2025, 12, 31, 23, 59),
visibilityType: VisibilityType.PRIVATE,
requiredFields: const [
RequiredField(
fieldId: 'YOU_FIELD_ID',
value: 'YOUR_FIELD_VALUE',
),
],
),
),
);
}
}
Parameters Explained #
- apiKey: API client key provided by Finik.
- isBeta: Whether to use the beta server.
- locale: The language used for UI translations. Supported options: FinikSdkLocale.KY, FinikSdkLocale.EN, FinikSdkLocale.RU.
- textScenario: Defines the context for displayed UI text. Accepted values: TextScenario.PAYMENT, TextScenario.REPLENISHMENT.
- paymentMethods: Defines which payment options are shown to users:
- [PaymentMethod.ALL] - Shows all available methods (APP + QR)
- [PaymentMethod.APP] - Mobile application payment only
- [PaymentMethod.QR] - QR code payment only
- enableShimmer: Controls the visibility of the shimmer animations in the app.
- enableShare: Controls the visibility of the share button in the app.
- enableSupportButtons: Controls whether support buttons are visible.
- tapableSupportButtons: Controls whether support buttons are interactive.
- onBackPressed: A function triggered when the back button is pressed. Useful for custom navigation or showing dialogs.
- onPayment: A function triggered when the payment is done. Returns the payment status and other payment data.
- widget: The
FinikWidget
managed byFinikProvider
. ('CreateItemHandlerWidget' or 'GetItemHandlerWidget')
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 the following FinikWidget options (see
FinikWidget Details above for context):
π§© Widgets #
1. CreateItemHandlerWidget #
Use this widget to create a new payment item and generate a QR code.
Parameters #
- accountId (required): This is the Finik account where the funds will be deposited, acquired from the merchant's clients. Reach out to Finik representatives to receive your corporate accountId along with the x-api-key.
- nameEn (required): A field used as a QR name that will be displayed to the merchant's clients on their devices upon payment.
- requestId (optional): A field to control the uniqueness of a request. For each request, it must be unique so that Finik ensures no duplicate QR items are created.
- amount (optional): Defines the payment configuration. Supported types:
- [FixedAmount] - A predefined, non-editable payment amount.
- [MinMaxAmount] - Allows users to enter an amount within a specified minimum and maximum range.
- [FreeAmount] - Fully flexible; users can input any amount.
- description (optional): A short description of the item. Displayed in the payment UI.
- callbackUrl (optional): A field used as a webhook. When specified, Finik will send a POST request to your server
with the payment details in its JSON body, including its final status (either SUCCEEDED or FAILED), as well as
requiredFields in the form of a
fields
object attribute. - For detailed specifications, see: https://quip.com/0IA3An5NLWRb
- maxAvailableQuantity (optional): Maximum number of times this item can be purchased. Prevents over-selling.
- maxAvailableAmount (optional): Maximum total payable amount allowed across all purchases of this item.
- startDate (optional): The start date and time from which the item becomes available for payment.
- endDate (optional): The end date and time after which the item is no longer available for payment.
- visibilityType (optional): Determines whether the item is public or private.
- requiredFields (optional): When specified, Finik will proxy the provided key:value in the
fields
field when sending the payment details to thecallbackUrl
, if configured.
Example Code #
widget: CreateItemHandlerWidget(
accountId: 'YOUR_ACCOUNT_ID',
nameEn: 'YOUR_ITEM_NAME_EN',
requestId: '110ec58a-a0f6-4ac4-8353-c86cd813b8d1',
amount: const FixedAmount(10.0),
description: 'YOUR_DESCRIPTION',
callbackUrl: 'YOUR_CALLBACK_URL',
maxAvailableQuantity: 100,
maxAvailableAmount: 1000,
startDate: DateTime(2025, 7, 1, 0, 0),
endDate: DateTime(2025, 12, 31, 23, 59),
visibilityType: VisibilityType.PRIVATE,
requiredFields: const [
RequiredField(
fieldId: 'YOU_FIELD_ID',
value: 'YOUR_FIELD_VALUE',
),
],
),
2. GetItemHandlerWidget #
Use this widget to retrieve an existing item by its ID or shortUrl and display its details.
Parameters #
- itemId: A required field. It is the unique ID for the item to fetch.
Example Code #
widget: GetItemHandlerWidget(
itemId: ItemId('YOUR_ITEM_ID'),
),
Compatibility #
- Dart: Version 3.0.0 or higher
- Platforms: Android (SDK 19+), iOS (13.0+)
πββοΈ Contributing #
- We welcome PRs and issues!
- Feel free to open discussions, suggest features, or contribute code.
π¨βπ» Author #
- Finik β engineering@quickpay.kg