EdfaPay SoftPos SDK
Installation
[!IMPORTANT]
Configure RepositoryConfigure Repositories The SDK requires Gradle Plugin Portal and JitPack repositories with authorization enabled. This allows Gradle to download the EdfaPay plugin from the plugin portal and the native dependencies from JitPack.
If your project build was configured to prefer settings repositories, Place the below maven block to project
./settings.gradlepluginManagement { repositories { // Add below at same gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { mavenCentral() // Add below at same maven { url "https://jitpack.io" credentials { username "jp_dtett6nt05eqiekvc4hp4og128" } } } }pluginManagement { val flutterSdkPath = run { val properties = java.util.Properties() file("local.properties").inputStream().use { properties.load(it) } val flutterSdkPath = properties.getProperty("flutter.sdk") require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } flutterSdkPath } includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) repositories { google() mavenCentral() maven { url = uri("https://jitpack.io") credentials { username = "jp_dtett6nt05eqiekvc4hp4og128" } } } }
If your project build was configured to prefer traditional build.gradle repositories, Place the below maven block to project
./build.gradleallprojects { repositories { // Add below at same gradlePluginPortal() maven{ url "https://jitpack.io" credentials{ username "jp_dtett6nt05eqiekvc4hp4og128" } } } }allprojects { repositories { google() mavenCentral() maven { url = uri("https://jitpack.io") credentials { username = "jp_i9ed2av1lj1kjnqpgobpeh0e7k" } } } }[!IMPORTANT]
Adding dependencyIt is important to Run this command with flutter`
flutter pub add edfapay_softpos_sdkThis will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):
dependencies : edfapay_softpos_sdk: ^0.0.5[!IMPORTANT]
Change the android MainActivity super classChange the android MainActivity inside android\app\src\main\kotlin\MainActivity.kt
Change the android MainActivity super class from FlutterActivity to FlutterFragmentActivity:
package com.example.example import io.flutter.embedding.android.FlutterFragmentActivity class MainActivity: FlutterFragmentActivity()
Usage
Importing the SDK
import 'package:edfapay_softpos_sdk/edfapay_softpos_sdk.dart';
import 'package:edfapay_softpos_sdk/enums/env.dart';
import 'package:edfapay_softpos_sdk/models/txn_params.dart';
import 'package:edfapay_softpos_sdk/models/edfapay_credentials.dart';Authenticating with EdfaPay
EdfaPayCredentials credentials = EdfaPayCredentials.withEmailPassword(
environment: Env.DEVELOPMENT,
email: "[email protected]",
password: "Demo@123"
);Initializing the EdfaPay Plugin
EdfaPayPlugin.initiate(credentials: credentials).then((value) {
if (value.status) {
// setTheme();
}
setState(() {
// Update SDK status for another use;
});
}).catchError((e) {
if (e is PlatformException) {
toast(context, e.message ?? e.code);
} else {
toast(context,"Error Initializing SDK");
}
});Performing a Pay/Purchase Transaction
final params = TxnParams.purchase(amount : amount, orderId : "12340987");
EdfaPayPlugin.pay(params, onPaymentProcessComplete: (status, code, result,
isProcessComplete) {
toast(context, "Card Payment Process Completed");
print('>>> Payment Process Complete');
print('Result : ${result.toString()}');
}, onServerTimeOut: () {
toast(context, "Server Request Timeout");
print('>>> Server Timeout');
print(' >>> The request timeout while performing transaction at
backend');
}, onScanCardTimeOut: () {
toast(context, "Card Scan Timeout");
print('>>> Scan Card Timeout');
print(' >>> The scan card timeout, no any card tap on device');
}, onCancelByUser: () {
toast(context, "Cancel By User");
print('>>> Canceled By User');
Edfapay SoftPOS SDK Flutter– Integration Guide
print(' >>> User have cancel the scanning/payment process on its own
choice');
}, onError: (Exception error) {
toast(context, error.toString());
print('>>> Exception');
print(' >>> "Scanning/Payment process through an exception, Check
the logs');
print(' >>> ${error.toString()}');
});Performing a Refund Transaction
final params = TxnParams.refundWithRrn(amount
: amountToPay, transactionDate
: DateTime(2025, 08, 26), rrn
: null, );
EdfaPayPlugin.refund(params, onPaymentProcessComplete: (status, code,
result, isProcessComplete) {
toast("Card Payment Process Completed");
print('>>> Payment Process Complete');
}, onServerTimeOut: () {
toast("Server Request Timeout");
print('>>> Server Timeout');
print(' >>> The request timeout while performing transaction at
backend');
}, onScanCardTimeOut: () {
toast("Card Scan Timeout");
print('>>> Scan Card Timeout');
print(' >>> The scan card timeout, no any card tap on device');
}, onCancelByUser: () {
toast("Cancel By User");
print('>>> Canceled By User');
print(' >>> User have cancel the scanning/payment process on its own
choice');
}, onError: (Exception error) {
toast(error.toString());
print('>>> Exceptio¬n');
print(' >>> "Scanning/Payment process through an exception, Check the
logs');
print(' >>> ${error.toString()}');
});Reconciling Transactions
EdfaPayPlugin.reconcile(
onSuccess: (response){
toast("Success reconcile");
},
onError: (error){
print('>>> Exception');
print(' >>> "Scanning/Payment process through an exception, Check
the logs');
print(' >>> ${error.toString()}');
}
);[!TIP]
Enable or Disable Logs
The developer can enable or disable logging at the SDK
EdfaPayPlugin.enableLogs(true);[!TIP]
Setting the animation speed
The developer can set the speed for animations for status and card scheme. It will control the process speed.
EdfaPayPlugin.animationSpeedX(2.0f);[!TIP]
Setting Theme
EdfaPayPlugin.theme.setButtonBackgroundColor("#06E59F")
.setButtonTextColor("#000000")
.setPoweredByImage(logo)
.setHeaderImage(logo);License
MIT