Demo
Setup
To run the demo app, you need to get the project and configure your API credentials:
Get the Demo Project
- Clone the Git repository:
https://github.com/koardlabs/koard-android-demo.git - Or download the ZIP file
Open the Project in Android Studio
- Open Android Studio
- Select File > Open
- Navigate to the
koard-android-demofolder and open it - Wait for Gradle sync to complete
The koard-android-demo repository is fully standalone—no parent project or linked modules required.
Configure Your Credentials
Open build.gradle.kts and update the credential values in the buildConfigField declarations:
android {
defaultConfig {
buildConfigField("String", "API_KEY", "\"YOUR_API_KEY_HERE\"")
buildConfigField("String", "MERCHANT_CODE", "\"YOUR_MERCHANT_CODE_HERE\"")
buildConfigField("String", "MERCHANT_PIN", "\"YOUR_MERCHANT_PIN_HERE\"")
buildConfigField("String", "STORE_ID", "\"YOUR_STORE_ID_HERE\"")
}
}
Replace the placeholder values:
YOUR_API_KEY_HERE- Your Koard API keyYOUR_MERCHANT_CODE_HERE- Your merchant codeYOUR_MERCHANT_PIN_HERE- Your merchant PINYOUR_STORE_ID_HERE- Your location/store ID
Important: For production use, externalize these credentials using secure storage or environment variables. Never commit actual credentials to version control.
Select Build Flavor
The demo app has three build flavors:
| Flavor | API Environment | Application ID Suffix |
|---|---|---|
| dev | Development | .dev |
| uat | UAT/Testing | .uat |
| prod | Production | (none) |
In Android Studio:
- Go to Build > Select Build Variant
- Choose your desired flavor (e.g.,
devDebugfor development)
Build the Project
Build the project using one of these methods:
Via Android Studio:
- Click Build > Make Project (⌘+F9 / Ctrl+F9)
Via Command Line:
# Build development flavor
./gradlew assembleDevDebug
# Build UAT flavor
./gradlew assembleUatDebug
# Build production flavor
./gradlew assembleProdRelease
Install on Physical Device
Physical Device Required: Tap to Pay on Android requires a physical device with NFC hardware. The emulator does not support NFC payments.
Prerequisites:
- Physical Android device with NFC support (Android 12+)
- Tap-to-pay kernel app installed on the device (see the Running Payments guide)
- USB debugging enabled on the device
Install the app:
Via Android Studio:
- Connect your device via USB
- Click Run > Run 'app' (Shift+F10)
Via Command Line:
# Install development build
./gradlew installDevDebug
# Install UAT build
./gradlew installUatDebug
Running the Demo
Launch the App
Open the Koard Demo app on your device. You should see the main screen.
Authenticate Merchant
Tap Login or Authenticate Merchant to authenticate using the credentials configured in your build.
You will know authentication was successful if you see:
- A success message or confirmation screen
- Options to proceed with device enrollment or location selection
Select Location
If your merchant has multiple locations:
- View the list of available locations
- Select your active location
- Confirm the selection
The selected location will be used for all transactions.
Device Enrollment (Automatic)
The Koard SDK automatically handles device enrollment after successful merchant login:
- The SDK checks if the required tap-to-pay kernel app is installed
- Generates device certificates
- Enrolls the device with Koard's payment services
- Starts the thin client for NFC transactions
Device enrollment happens automatically in the background. You don't need to manually provide additional credentials—the SDK handles everything internally. Check the Settings screen in the demo to view enrollment status.
You will know enrollment was successful if you see:
- SDK status shows "Ready for Transactions"
- Device certificates are generated
- NFC transactions can be initiated
Disable Developer Mode
IMPORTANT: Turn Off Developer Mode
Before processing any tap to pay transactions, you MUST disable developer mode on your Android device:
- Go to Settings > System > Developer Options
- Toggle Developer Mode to OFF
- Restart your device (recommended)
Tap to Pay transactions will fail if developer mode is enabled. This is a security requirement from the payment processor.
Developer Workflow:
- Enable Developer Mode → Install/update app → Disable Developer Mode → Run transactions
Process Sample Transaction
Test a contactless payment:
- Tap Process Transaction or New Payment
- Enter a sample dollar amount (e.g., $10.00)
- Select transaction type (Sale or Preauth)
- Tap Start or Continue
Complete Tap to Pay Transaction
Complete the payment flow:
- Prompt the customer to tap their card or phone
- Hold the card/phone against the device's NFC reader
- Wait for the transaction to process
- View the transaction result (approved/declined)
Transaction details will include:
- Transaction ID
- Authorization code
- Card type and last 4 digits
- Amount charged
- Transaction status
View Transaction History
Navigate to Transaction History to:
- View all completed transactions
- Filter by date or status
- View detailed transaction information
- Send receipts via email or SMS
Demo App Features
The demo app showcases the following SDK capabilities:
Merchant Authentication
- Login with merchant code and PIN
- Session management
- Automatic token refresh
Device Enrollment
- NFC configuration with Koard's tap-to-pay services
- Certificate management
- Device provisioning status
Location Management
- Retrieve all merchant locations
- Select active location
- Location-based transaction processing
Transaction Processing
- Sale transactions (immediate capture)
- Preauthorization (auth hold)
- Capture (settle preauth)
- Refund processing
- Transaction reversal
- Tip adjustment
Transaction History
- List all transactions
- View transaction details
- Filter and search
- Transaction status tracking
Digital Receipts
- Send receipts via email
- Send receipts via SMS
- Receipt customization
Project Structure
The demo app structure:
koard-android-demo/
├── src/
│ └── main/
│ ├── java/com/koard/android/
│ │ ├── DemoApplication.kt
│ │ ├── MainActivity.kt
│ │ └── ui/
│ ├── res/
│ └── AndroidManifest.xml
├── libs/ # Embedded SDK AARs (dev/uat/prod)
├── libs-maven/ # Local Maven repo for the SDK fat AAR
├── build.gradle.kts # Build configuration
├── settings.gradle.kts
└── README.md
SDK Integration
The demo app uses the Koard Android SDK embedded as "fat AAR" files. These artifacts already bundle the SDK along with the tap-to-pay thin client and shared libraries, so you only need to reference the single AAR per environment.
The SDK is automatically selected based on your build flavor:
- Dev builds → Use
koard-android-dev-release.aar - UAT builds → Use
koard-android-uat-release.aar - Prod builds → Use
koard-android-prod-release.aar
Build Commands Reference
# Clean build
./gradlew clean
# Build all flavors
./gradlew build
# Build specific flavor
./gradlew assembleDevDebug
./gradlew assembleUatDebug
./gradlew assembleProdRelease
# Install on device
./gradlew installDevDebug
./gradlew installUatDebug
# Uninstall from device
./gradlew uninstallDevDebug
./gradlew uninstallUat
# Run tests
./gradlew test
# Generate APK
./gradlew assembleDebug
./gradlew assembleRelease
Troubleshooting
Common Issues
App crashes on startup
Solution:
- Verify credentials are configured correctly in
build.gradle.kts - Check that you're not using placeholder values (YOUR_API_KEY_HERE)
- Review Logcat for specific error messages
"Device not provisioned" error
Solution:
- Ensure the tap-to-pay kernel app is installed (see the Running Payments guide for setup steps)
- The SDK automatically handles device enrollment after successful merchant login
- Check NFC hardware is functioning
- Verify the kernel app is up to date
NFC not working
Solution:
- Confirm device has NFC hardware
- Enable NFC in device settings
- Verify device enrollment was successful
- Test with a physical payment card
- IMPORTANT: Ensure developer mode is DISABLED on the device
"Transaction failed" or "NFC error" during tap to pay
Solution:
- Disable developer mode - This is the most common cause of transaction failures
- Go to Settings > System > Developer Options and toggle OFF
- Restart your device after disabling developer mode
- Ensure the tap-to-pay kernel app is running and up to date
- Check that NFC is enabled in device settings
Build errors
Solution:
- Verify JDK 21 is configured
- Check minimum SDK is set to 31
- Clean and rebuild:
./gradlew clean build - Invalidate caches: File > Invalidate Caches / Restart
Network errors
Solution:
- Check device has internet connection
- Verify API key and credentials are correct
- Ensure you're using the correct build flavor for your environment (dev/uat/prod)
Debugging Tips
Enable verbose logging:
Add this to see detailed SDK logs:
import android.util.Log
// In your Application or Activity
KoardMerchantSdk.getInstance().apply {
// Enable debug logging if available
}
Check Logcat:
Filter by package name to see app-specific logs:
adb logcat | grep "com.koardlabs"
Verify SDK version:
Check which SDK version the demo is using:
./gradlew dependencies | grep koard
Security Notes
- Never commit actual credentials to version control
- Use environment variables or secure credential management for production
- The
build.gradle.ktscredentials are for demo purposes only - Consider using Android Keystore for sensitive data in production apps
- Keep the demo app on devices used exclusively for testing
Updating the SDK
To update to a newer version of the SDK in the demo app:
- Download the latest Koard Android SDK fat AAR.
- Copy the resulting AAR into
libs/(or publish them intolibs-maven/) inside thekoard-android-demoproject. - Rebuild the demo app.
Next Steps
After running the demo app successfully:
- Install SDK in Your App - Integrate SDK into your own application
- Merchant Authentication - Implement login flows
- Transaction Processing - Process payments
- Payment Lifecycle - Understand payment flows
- Error Handling - Handle SDK errors gracefully
Support
For technical support or questions:
- Email: support@koard.com
- Documentation: https://docs.koard.com
- GitHub Issues: https://github.com/koardlabs/koard-android-demo/issues