finik_sdk 0.2.0 copy "finik_sdk: ^0.2.0" to clipboard
finik_sdk: ^0.2.0 copied to clipboard

This Flutter package allows your application to integrate Finik application features.

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 page 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: kg, en, ru

πŸ’‘ 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.KG,
        useHiveForGraphQLCache: false,
        onBackPressed: () {
          print("ExampleApp: Back pressed");
        },
        onPaymentSuccess: (data) {
          print('ExampleApp: Payment succeeded: $data');

          // OUTPUT example:
          // payment succeeded: {accountId: test_account_id, amount: 77.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) {
          print("ExampleApp: Payment failed: $message");
        },
        widget: const CreateItemHandlerWidget(
          accountId: 'YOUR_ITEM_ID',
          nameEn: 'YOUR_NAME_EN',
          callbackUrl: 'YOUR_CALLBACK_URL',
          textScenario: TextScenario.replenishment,
          fixedAmount: 33.33,
          requiredFields: [
            RequiredField(
              fieldId: 'YOU_FIELD_ID_FOR_REQUIRED_FIELD',
              value: 'YOUR_VALUE',
            ),
          ],
        ),
      ),
    );
  }
}

Parameters Explained #

  • apiKey: Your API key from the Finik server.
  • isBeta: Whether to use the beta server.
  • locale: The language for translations. Supported options: 'kg', '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).
  • onBackPressed: A function triggered when the back button is pressed. Useful for custom navigation or showing dialogs.
  • 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.
  • widget: The FinikWidget managed by FinikProvider.

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:

🧩 Widgets #

1. CreateItemHandlerWidget #

Use this widget to create a new payment item and generate a QR code.

Parameter Type Description
accountId String Required account identifier
nameEn String Item name (English)
callbackUrl String? Optional callback URL
textScenario TextScenario UI text variant (.payment, .replenishment)
fixedAmount Double QR amount
requiredFields [RequiredField] Additional form fields

Example Code #

CreateItemHandlerWidget(
  accountId: 'YOUR_ITEM_ID',
  nameEn: 'YOUR_NAME_EN',
  callbackUrl: 'YOUR_CALLBACK_URL',
  textScenario: TextScenario.payment,
  fixedAmount: 77.95,
  requiredFields: [
    RequiredField(
      fieldId: 'FIELD_ID',
      value: 'VALUE',
    ),
  ],
)

2. GetItemHandlerWidget #

Use this widget to retrieve an existing item by its ID and display its details.

Parameters #

Parameter Type Description
itemId String The unique ID for the item to fetch
textScenario TextScenario UI text variant (.payment, .replenishment)

Example Code #

GetItemHandlerWidget(
  itemId: 'YOUR_ACCOUNT_ID',
  textScenario: TextScenario.payment,
)

Compatibility #

  • Dart: Version 2.17.0 or higher
  • Platforms: Android (SDK 19+), iOS (12.0+)

πŸ™‹β€β™‚οΈ Contributing #

  • We welcome PRs and issues!
  • Feel free to open discussions, suggest features, or contribute code.

πŸ‘¨β€πŸ’» Author #