Android Library (Java)
Native Android payment library for seamless integration into Android Studio projects.
Repository: Mobile-XDK-Fiuu_Android_Library
Requirements
| Requirement | Version |
|---|---|
compileSdk | 37+ (required by library 3.34.41+) |
targetSdkVersion | 37+ |
minSdkVersion | 26+ |
| Android Gradle Plugin | 9.1.1+ (supports compileSdk 37) |
| Gradle | 9.0+ (sample uses 9.6.1) |
| JDK | 17 |
| Android Studio | Panda 3 / 2025.3.3 Patch 1 or newer (required for API 37) |
Current library version: 3.34.41 (releases, JitPack)
Installation
1. Configure Maven Repositories
Add JitPack to your project repositories.
settings.gradle (or settings.gradle.kts) — preferred:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Or, for projects still using root build.gradle / allprojects:
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
2. Add Dependency
In build.gradle (Module :app):
dependencies {
implementation 'com.github.FiuuPayment:Mobile-XDK-Fiuu_Android_Library:3.34.41'
}
Replace 3.34.41 with the latest release tag if a newer version is available.
3. AndroidManifest
Ensure your app declares internet access. Google Pay also requires the Wallet API meta-data:
<uses-permission android:name="android.permission.INTERNET" />
<application>
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
4. Import Classes
import com.fiuu.xdk.PaymentActivity;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import java.util.HashMap;
For Google Pay, also import:
import com.fiuu.xdk.googlepay.ActivityGP;
import com.fiuu.xdk.googlepay.UtilGP;
import com.google.android.gms.wallet.button.ButtonConstants;
import com.google.android.gms.wallet.button.ButtonOptions;
import com.google.android.gms.wallet.button.PayButton;
5. ProGuard Rules
Add to proguard-rules.pro:
# For WebView / Javascript bridge
-keepclassmembers class * {
@android.webkit.JavascriptInterface <methods>;
}
# Keep XDK classes (prevents obfuscation of JS bridge / payment result handling)
-keep class com.fiuu.xdk.** { *; }
Basic Integration
HashMap<Object, Object> paymentDetails = new HashMap<>();
paymentDetails.put(PaymentActivity.mp_username, "");
paymentDetails.put(PaymentActivity.mp_password, "");
paymentDetails.put(PaymentActivity.mp_app_name, "");
paymentDetails.put(PaymentActivity.mp_merchant_ID, "");
paymentDetails.put(PaymentActivity.mp_verification_key, "");
paymentDetails.put(PaymentActivity.mp_amount, "1.01"); // 2 decimal points
paymentDetails.put(PaymentActivity.mp_order_ID, Calendar.getInstance().getTimeInMillis()); // Unique per attempt
paymentDetails.put(PaymentActivity.mp_currency, "MYR");
paymentDetails.put(PaymentActivity.mp_country, "MY");
paymentDetails.put(PaymentActivity.mp_bill_description, "The bill description");
paymentDetails.put(PaymentActivity.mp_bill_name, "Payer Name");
paymentDetails.put(PaymentActivity.mp_bill_email, "payer.email@fiuu.com");
paymentDetails.put(PaymentActivity.mp_bill_mobile, "123456789");
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(PaymentActivity.XDKPaymentDetails, paymentDetails);
paymentActivityResultLauncher.launch(intent);
Handle Result
Payment results are returned as a JSON string via XDKTransactionResult.
ActivityResultLauncher<Intent> paymentActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getData() != null) {
String transactionResult = result.getData()
.getStringExtra(PaymentActivity.XDKTransactionResult);
Log.d(PaymentActivity.logXDK, "transaction result = " + transactionResult);
}
}
);
Standard checkout returns the status_code format. See Response Handling.
Express Mode
Requires a valid subscribed mp_channel. Credit channels cannot use express mode.
paymentDetails.put(PaymentActivity.mp_express_mode, true);
paymentDetails.put(PaymentActivity.mp_channel, "maybank2u");
Channel Filtering
String[] allowedchannels = {"TNG-EWALLET", "maybank2u"};
paymentDetails.put(PaymentActivity.mp_allowed_channels, allowedchannels);
Channel codes are listed in the channel list.
Environment Configuration
Set mp_core_env to select the XDK environment. See Core Integration.
paymentDetails.put(PaymentActivity.mp_core_env, "4"); // Sandbox
Google Pay
Google Pay uses ActivityGP instead of PaymentActivity. Results use the StatCode format — see Google Pay Result.
Requirements for Production
Request production access from Google Pay Console. Choose integration type Gateway and provide app screenshots. Launch from a signed release build with production credentials after approval.
Use Sandbox (mp_core_env = "4") and Sandbox credentials until Google Pay production access is approved.
Google Pay (Express Mode)
private void googlePayPayment() {
paymentDetails = new HashMap<>();
paymentDetails.put(PaymentActivity.mp_merchant_ID, ""); // Sandbox for test; production after approval
paymentDetails.put(PaymentActivity.mp_verification_key, "");
paymentDetails.put(PaymentActivity.mp_amount, "1.01");
paymentDetails.put(PaymentActivity.mp_order_ID, Calendar.getInstance().getTimeInMillis());
paymentDetails.put(PaymentActivity.mp_currency, "MYR");
paymentDetails.put(PaymentActivity.mp_country, "MY");
paymentDetails.put(PaymentActivity.mp_bill_description, "The bill description");
paymentDetails.put(PaymentActivity.mp_bill_name, "The bill name");
paymentDetails.put(PaymentActivity.mp_bill_email, "payer.email@fiuu.com");
paymentDetails.put(PaymentActivity.mp_bill_mobile, "123456789");
paymentDetails.put(PaymentActivity.mp_core_env, "4"); // Sandbox
// Optional — limit payment methods (MY/MYR only for e-wallets)
paymentDetails.put(PaymentActivity.mp_gpay_channel, new String[]{"CC", "TNG-EWALLET"});
paymentDetails.put(PaymentActivity.mp_company, "Your Company Name");
paymentDetails.put(PaymentActivity.mp_extended_vcode, false);
Intent intent = new Intent(this, ActivityGP.class);
intent.putExtra(PaymentActivity.XDKPaymentDetails, paymentDetails);
gpActivityResultLauncher.launch(intent);
}
Handle the result the same way as standard checkout — read PaymentActivity.XDKTransactionResult.
Verify Google Pay results on your backend:
VrfKey = md5(Amount + secret_key + Domain + TranID + StatCode)
Payment Parameters
See Payment Parameters for the full list of mp_* parameters.