Implement inside the flutter app:-

dependencies:
   easy_pay_develop: ^0.0.2

Android Side

This guide provides step-by-step instructions to configure your Flutter project with the necessary Android dependencies and settings.

Step 1: Add SoftPos-v1.3.66.11-Debug_Test.aar to Your Project

  1. Navigate to the android folder in your Flutter project.
  2. Create a new folder named libs inside the android folder.
  3. Paste the SoftPos-v1.3.66.11-Debug_Test.aar file into the libs folder.

Step 2: Add below permissions in AndroidManifest.xml file:-

  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

Step 3: Update build.gradle File

  1. Open the android/app/build.gradle file.

  2. In the dependencies section, add the following lines of code:

    implementation 'com.sdk:easypay:1.1.5'
    implementation 'com.denovo:topliteapp:1.7.5.1'
    compileOnly files('libs/SoftPos-v1.3.66.11-Debug_Test.aar')
    

Step 4: Extend FlutterActivity in MainActivity

  1. Navigate to android/app/src/main/kotlin/your/package/name/.

  2. Create or update the MainActivity.kt file with the following code:

    import android.os.Bundle
    import io.flutter.embedding.android.FlutterActivity
    import io.flutter.embedding.engine.FlutterEngine
    import io.flutter.plugin.common.MethodChannel
    import io.flutter.plugins.GeneratedPluginRegistrant
    
    class MainActivity : FlutterActivity() {
    
        private val CHANNEL = "easy_pay_develop"
        private var easyPayPlugin: EasyPayPlugin? = null
    
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            // Initialize the EasyPay plugin
            easyPayPlugin = EasyPayPlugin()
            easyPayPlugin?.setActivity(this)
        }
    
        override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
            super.configureFlutterEngine(flutterEngine)
            GeneratedPluginRegistrant.registerWith(flutterEngine)
            easyPayPlugin?.let {
                flutterEngine.plugins.add(it)
            }
    
            MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
                when (call.method) {
                    "startPayment" -> {
                        val secretKey = call.argument<String>("secretKey") ?: ""
                        val jsonRequest = call.argument<String>("jsonRequest") ?: ""
                        easyPayPlugin?.onMethodCall(call, result)
                    }
                    "registerDevice" -> {
                        val tpn = call.argument<String>("tpn") ?: ""
                        val merchantKey = call.argument<String>("merchantKey") ?: ""
                        easyPayPlugin?.onMethodCall(call, result)
                    }
                    else -> {
                        result.notImplemented()
                    }
                }
            }
        }
    }
    

By following these steps, you will successfully configure your Flutter project with the necessary Android dependencies and settings. If you encounter any issues, please refer to the respective documentation for additional assistance.

Step 5 : Now in settings.gradle file, inside the repositories section add below code:-

maven {
            url = uri("s3://denovo-android.s3.amazonaws.com")
            credentials(AwsCredentials) {
                accessKey = "accessKey"
                secretKey = "secretKey"
            }
        }
  maven {
            url = uri("gitUrl")
            credentials {
                username = "Username"
                password = "password"
            }
        }

Step 6: Now add in gradle.properties add below code:-

android.enableJetifier=true
android.disableAutomaticComponentCreation=true

Step 7: Android call function.

To call in the android side

  Future<void> startTransaction() async {
   try {
      var status = await Permission.location.status;
      if (!status.isGranted) {
         status = await Permission.location.request();
         if (!status.isGranted) {
            showSnackbar('Location permission denied. Kindly allow the permission.');
            return;
         }
      }

      final response = await _easyPay.registerDevice('tpnKey', 'merchantKey');
      print("Transaction successful: $response");

      Map<String, dynamic> decodedResponse = jsonDecode(response ?? '{}');
      String? sessionKey = decodedResponse['session_key'];

      if (sessionKey != null) {
         print('Session Key: $sessionKey');
         var uuid = Uuid();
         // change the parameters value with your values except type
         Map<String, dynamic> paymentData = {
            'type': 'SALE', // must be SALE
            'amount': '1', // change amount value with your value
            'isreceiptsneeded': false,
            'showapprovalscreen': false,
            'Customobject': {
               'customeremail': 'graghu@denovosystem.com',
               'PhoneNumber': '919840720372',
               'CreditType': '1',
               'NumberOfPayments': '1',
               'ExtraData': '[]',
               'HolderID': '1',
               'TransactionUniqueIdForQuery': uuid.v1()
            }
         };

         String jsonRequest = jsonEncode(paymentData);

         final paymentResponse = await _easyPay.startPayment( sessionKey, jsonRequest);
         print('Payment initiated: $paymentResponse');

      } else {
         print('Session key not found in response.');
      }

   } catch (e) {
      showSnackbar('Failed to start transaction: $e');
   }
}

IOS side

This guide provides step-by-step instructions to configure your Flutter project with the necessary IOS dependencies and settings.

Step 1: Add below permissions in info.plist file:-

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

<key>NSLocationWhenInUseUsageDescription</key>
<string>Reason why your app needs access to location when in use</string>

<key>NSLocationAlwaysUsageDescription</key>
<string>Reason why your app needs access to location always</string>

Step 2: Example code for IOS:-

Future<void> makeRequest() async {
    try {
      final response = await _easyPay.requestWith('merchantKey');
      print("Request successful: $response");
    } catch (e) {
      showSnackbar('Failed to make request: $e');
    }
  }

  Future<void> performTransaction() async {
    try {
      final response = await _easyPay.transactionWith(100.0, 1);  // change amount with your value
      print("Transaction successful: $response");
    } catch (e) {
      showSnackbar('Failed to perform transaction: $e');
    }
  }

First call makeRequest() function. After that call the performTransaction().

For more info, please go with the EXAMPLE tab.