easy_pay 0.0.2
easy_pay: ^0.0.2 copied to clipboard
EasyPay SDK.
easy_pay android implementation #
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.7-Debug_Test.aar to Your Project #
- Navigate to the
androidfolder in your Flutter project. - Create a new folder named
libsinside theandroidfolder. - Paste the
SoftPos-v1.3.66.7-Debug_Test.aarfile into thelibsfolder.
Step 2: Update build.gradle File #
-
Open the
android/app/build.gradlefile. -
In the
dependenciessection, add the following lines of code:implementation 'com.sdk:easypay:1.1.1' implementation 'com.denovo:topliteapp:1.7.5.0' compileOnly files('libs/SoftPos-v1.3.66.7-Debug_Test.aar')
Step 3: Configure Repositories #
- Open the
android/settings.gradlefile. - In the
dependencyResolutionManagementsection, underrepositories, add the following code:
Step 3: Extend FlutterActivity in MainActivity #
-
Navigate to
android/app/src/main/kotlin/your/package/name/. -
Create or update the
MainActivity.ktfile 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" 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 amount = call.argument<String>("amount") ?: "" 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.