finik_sdk 1.3.0 copy "finik_sdk: ^1.3.0" to clipboard
finik_sdk: ^1.3.0 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

πŸ’‘ 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],
        enableShare: true,
        tapableSupportButtons: 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-a0f2-4ac4-8393-c866d813b8d1',
          description: 'YOUR_ITEM_DESCRIPTION',
          callbackUrl: 'YOUR_CALLBACK_URL',
          fixedAmount: 9.99,
          maxAvailableQuantity: 1,
          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
  • enableShare: Controls the visibility of the share button in the app bar.
  • 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 by FinikProvider. ('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: A required field. It is the Finik account where the funds will be deposited acquired from merchant's clients. Reach out to Finik representatives to receive your corporate accountId with x-api-key.
  • nameEn: A required field used as a QR name that will be displayed to merchant's clients on their devices upon payment.
  • requestId: An optional field to control the uniqueness of a request. For each request it must be unique so that Finik makes sure there are no duplicate QR items being created.
  • description: An optional field to specify a description.
  • callbackUrl: An optional field used as a webhook; when specified, Finik will send a POST request to your server with the payment details in its body in JSON format, including its final status that can be either SUCCEEDED or FAILED as well as requiredFields in the form of fields object attribute.
  • fixedAmount: An optional field. When specified, a QR is generated with this specific amount. The merchant's client will not be able to specify any custom amount.
  • maxAvailableQuantity: An optional field. The value must be 1 or null.
  • requiredFields: An optional field. When specified, Finik will proxy the provided key:value in the fields field when sending the payment details to callbackUrl if configured.

Example Code #

widget: CreateItemHandlerWidget(
  accountId: 'YOUR_ACCOUNT_ID',
  nameEn: 'YOUR_ITEM_NAME_EN',
  requestId: '110ec58a-a0f2-4ac4-8393-c866d813b8d1',
  description: 'YOUR_ITEM_DESCRIPTION',
  callbackUrl: 'YOUR_CALLBACK_URL',
  fixedAmount: 9.99,
  maxAvailableQuantity: 1,
  requiredFields: const [
    RequiredField(
      fieldId: 'YOU_FIELD_ID',
      value: 'YOUR_FIELD_VALUE',
    ),
  ],
),

2. GetItemHandlerWidget #

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

Parameters #

  • itemId: A required field. It is the unique ID for the item to fetch.

Example Code #

widget: GetItemHandlerWidget(
  itemId: 'YOUR_ITEM_ID',
),

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 #