Troubleshooting

Real-world fixes for issues merchants commonly hit when enrolling devices or running their first tap. If a device fails the SDK eligibility check, see Supported Devices & NFC Tap Location. For wrapped exceptions and their code mappings, see SDK Error Codes. For emitted transaction statuses, see SDK Response Codes.

What you learn

In this guide, you'll learn:

  • How to fix the "tap was immediately cancelled" issue
  • How to fix companion-app detection after installation
  • How to resolve enrollment failures caused by device clock drift
  • How to recover from a TamperDetected error on every sale after a failed enrollment
  • What to do when the reader service is busy with another merchant app
  • How to fix the "SDK not initialized" error
  • Which device settings must be enabled before a merchant's first transaction
  • A pre-flight checklist to run before contacting Koard support

Tap is Immediately Cancelled

Symptom

The merchant enrolls successfully and the SDK reports the device as eligible. When they attempt their first sale, the reader shows "Present card", but the moment the customer taps, the transaction is immediately cancelled: the SDK emits an Abort (or OnFailure) before the card is read.

This has been observed across several Android devices, with Samsung Galaxy S21 being the most common: but any Android device that exposes a separate "NFC and contactless payments" (or similarly named) toggle can hit it.

Cause

Many Android devices ship with two distinct NFC settings:

  1. NFC: the basic NFC radio toggle (enabled by default on most devices).
  2. NFC and contactless payments: a separate setting that authorizes the device to use NFC for payment-related Host Card Emulation (HCE) and Tap to Pay flows. Different OEMs label this differently (e.g. "NFC and contactless payments", "NFC and contactless transactions", "Contactless payments").

The SDK eligibility check verifies that NFC hardware is present and the radio is on, which is why enrollment and the eligibility check both pass. However, if the secondary "NFC and contactless payments" setting is disabled, the reader service cannot complete the contactless card read; the device's payment subsystem blocks the read and the transaction is cancelled before any card data is exchanged.

Fix

On the merchant's device:

  1. Open Settings
  2. Tap Connections (or Connected devices depending on the OEM and Android version)
  3. Tap NFC and contactless payments (sometimes labeled NFC and contactless transactions or simply Contactless payments)
  4. Ensure the master toggle is On
  5. Optionally set Contactless payments → Default payment app to your merchant app, or leave it as the system default if your app does not require the system payment role

After enabling the setting, retry the sale. No re-enrollment is required.

Why the eligibility check doesn't catch this: Basic device capability checks verify NFC hardware and the system NFC radio. The OEM-specific "contactless payments" toggle gates a higher layer (the payment HCE subsystem) and is not visible to the eligibility API. If a merchant sees taps cancelled instantly, always confirm this setting before deeper debugging.

If "NFC and contactless payments" is enabled and the tap is still cancelled instantly, check whether a wallet app (Samsung Wallet, Google Wallet, etc.) is set as the default and is intercepting the tap. Temporarily clear the default payment app under NFC and contactless payments → Contactless payments, then retry.

Companion App Is Not Detected

If readinessState.value.kernelAppInstalled remains false after installing the Visa Tap to Pay Ready app, check Android package visibility before reinstalling anything.

Android 11 and later hide other installed apps unless the app manifest declares the required visibility. Add this <queries> entry directly under <manifest> so the SDK can detect the Visa Tap to Pay Ready app. The SDK does not contribute this declaration.

<queries>
    <package android:name="com.visa.kic.app.kernel" />
</queries>

Rebuild and reinstall your merchant app, then call refreshReadinessChecks() on a worker thread. The required declaration exposes only the companion app; do not add QUERY_ALL_PACKAGES. See Configure AndroidManifest.xml.

Enrollment Fails or Returns Errors

Symptom

Calls to enrollDevice() (or the SDK's enrollment flow) fail with errors such as:

  • InvalidRequest: "Developer mode is enabled", "Device already enrolled", or no active location was set. enrollDevice() requires an authenticated session and a prior setActiveLocation(locationId) call
  • A wrapped enrollment failure
  • AuthenticationFailed (status code 7)
  • AttestationFailed (status code 24)
  • CouldNotAttestError
  • Generic prepare errors in the 7:51 range

The merchant sees an "Enrollment failed" screen and cannot proceed to take their first tap.

Cause

Enrollment establishes a secure channel between the device and the payment service. That handshake includes a device attestation step that is sensitive to three things:

  1. Developer mode is enabled: most enrollment endpoints reject devices with developer options on, because the device cannot produce a trustworthy attestation.
  2. The device clock has drifted: The enrollment service verifies signed timestamps during the handshake. If the device clock is off by more than a few minutes (a "clock drift" issue), signatures fail to verify and attestation is rejected. This is most common on devices that have been offline for a long time, recently factory-reset, or have automatic time disabled.
  3. Google Play Protect is disabled: Play Protect provides the integrity signals used to attest the device. With Play Protect off, the attestation payload is incomplete and enrollment is rejected.

Fix

Walk the merchant through all three checks before retrying enrollment:

1. Disable Developer Mode

  1. Open Settings → System → Developer options
  2. Toggle Developer options to Off
  3. If the option is missing entirely, developer mode is already off: proceed to the next step

If developer mode was on, restart the device after disabling it.

2. Enable Automatic Date & Time

  1. Open Settings → General management → Date and time (Samsung) or Settings → System → Date & time (stock Android)
  2. Toggle Automatic date and time to On
  3. Toggle Automatic time zone to On
  4. Wait a few seconds for the device to sync with the network time source

This corrects clock drift and is the most common fix when enrollment fails on a device that previously worked.

3. Enable Google Play Protect

  1. Open the Google Play Store app
  2. Tap your profile icon (top right) → Play Protect
  3. Tap the gear icon (settings) in the top right of the Play Protect screen
  4. Toggle Scan apps with Play Protect to On

Play Protect must be enabled for the device attestation step to succeed. If the merchant cannot enable Play Protect (for example on a device without Google Mobile Services), the device is not eligible for Tap to Pay.

After all three checks pass, restart the device and retry enrollment. If the SDK still returns an enrollment error, record exception.error.errorType and a redacted exception.error.shortMessage, then consult SDK Error Codes. Record a numeric statusCode separately if it was supplied on a reader event.

Why clock drift matters: The device attestation handshake relies on signed timestamps to prevent replay attacks. The SDK's enrollment flow includes a fresh nonce and a device-side timestamp; if the device clock is more than a few minutes off the server clock, the server rejects the timestamp and the handshake fails, often surfacing as a generic AuthenticationFailed (code 7) or AttestationFailed (code 24). Enabling automatic time syncs the device against a network time source and eliminates the drift.

TamperDetected on Every Sale After a Failed Enrollment

Symptom

enrollDevice() (or enableNfcTransactionsAsync(...)) appears to finish but reports a non-success status. Afterwards, every sale throws KoardErrorType.DeviceIntegrityError.TamperDetected (status code 1002). Clearing the app's data via Android Settings makes the next enrollment succeed: which points at corrupted local state rather than a genuinely tampered device.

Cause

A partial enrollment can leave the SDK's local preferences (certificates, device identifiers, and authentication keys) half-written and out of sync with the reader service's internal state. The mismatch surfaces as a false TamperDetected on the next transaction.

Fix

Call clearEnrollmentState() from a worker thread to wipe the local enrollment preferences, then re-attempt enrollment. The active location is intentionally preserved, and this is a local-only operation: it does not contact the backend.

lifecycleScope.launch(Dispatchers.IO) {
    val sdk = KoardMerchantSdk.getInstance()
    sdk.clearEnrollmentState()
    sdk.enrollDevice() // or enableNfcTransactionsAsync(...)
}

Use clearEnrollmentState() for incomplete enrollment recovery. For a fully enrolled device, unenrollDevice() requests cleanup of the reader enrollment and clears local SDK enrollment state. Inspect its returned status before proceeding.

Local cleanup does not confirm remote deprovisioning. Coordinate permanent device deactivation with Koard support.

Tap to Pay Is Busy with Another Merchant App

Symptom

A sale reports that the reader is in use by another merchant app. When a reader status code is available, this condition is 98.

Cause

A different merchant app on the same device currently owns the reader connection.

Fix

Ask the operator to close the other merchant app (or wait for it to finish its transaction), then retry.

Calling resetKernelService() will not resolve this: the lock is owned by a different process, not your app.

"SDK Not Initialized" Error

Symptom

IllegalStateException: Instance is null. Did you forget to call initialize?

is thrown the first time you call KoardMerchantSdk.getInstance().

Cause

getInstance() was called before KoardMerchantSdk.initialize(...) completed.

Fix

Initialize the SDK in Application.onCreate() on a worker thread (Dispatchers.IO) before any code accesses getInstance(). See the Installing the SDK guide for the recommended startup sequence.

Installation and Build Issues

For the released error types and recovery steps, see SDK Error Codes and Troubleshooting.

Common Installation Issues

SDK Not Initialized Error

IllegalStateException: Instance is null. Did you forget to call initialize?

Solution: Ensure KoardMerchantSdk.initialize() is called in Application.onCreate() on a worker thread before accessing getInstance().

Thread Enforcement Error

Solution: All SDK operations must be called from a worker thread. Use Dispatchers.IO:

lifecycleScope.launch(Dispatchers.IO) {
    // SDK operations here
}

Dependency Conflicts

Solution: Ensure you're using compatible versions of AndroidX and Kotlin libraries. Check for dependency conflicts with:

./gradlew app:dependencies

Build Errors

Solution:

  • Verify you're using JDK 21
  • Ensure minimum SDK is set to 33 (Android 13)
  • Clean and rebuild: ./gradlew clean build

NFC Transactions Failing

Solution:

  • Disable developer mode before running transactions - This is required for security
  • Developer mode blocks tap to pay functionality
  • Workflow: Enable dev mode → Install app → Disable dev mode → Run transactions
  • Go to Settings > System > Developer Options and toggle OFF
  • Restart device after disabling developer mode

Verification Checklist

  • Android Studio Hedgehog or newer installed
  • JDK 21 configured
  • Minimum SDK set to 33 (Android 13)
  • mavenCentral() present in repositories
  • SDK dependency added to build.gradle.kts
  • Application class created and registered
  • SDK.initialize() called on worker thread
  • Required permissions added to manifest (INTERNET, ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE, REBOOT, NFC, WAKE_LOCK)
  • Required <queries> entry for the Visa Tap to Pay Ready app added to the manifest
  • NFC TECH_DISCOVERED intent filter and @xml/nfc_tech_filter meta-data added to your tap activity
  • registerActivityForNfc() / unregisterActivityForNfc() wired into onResume() / onPause()
  • setActiveLocation(locationId) called after login
  • enrollDevice() exposed as an explicit user action and completed successfully
  • Project builds without errors
  • Import statements work correctly
  • Visa Tap to Pay Ready app 25.06.10 or later installed directly from Google Play or through the optional in-app flow
  • refreshReadinessChecks() runs on resume, and readinessState.value.kernelAppInstalled is true before enrollment
  • Physical device with NFC available for testing
  • Aware of developer mode workflow (enable → install → disable → run transactions)

Demo App Issues

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 Visa Tap to Pay Ready app is installed (see the Running Payments guide for setup steps)
  • Confirm you selected a location and then pressed Enroll Device: enrollment never runs on its own
  • Check NFC hardware is functioning
  • Verify the companion 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 Visa Tap to Pay Ready app is running and up to date
  • Check that NFC is enabled in device settings

Build errors

Solution:

  • Verify JDK 21 is configured
  • The public demo declares minSdk = 31; use a supported Android 13+ device for the reader flow. Your own app can set minSdk = 33 to enforce that device requirement.
  • 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 (uat/prod)

Debugging Tips

Enable verbose logging:

SDK log verbosity is set once, at initialization: there is no runtime setter. Pass a KoardLogLevel in DemoApplication.onCreate():

import com.koardlabs.merchant.sdk.domain.KoardLogLevel

KoardMerchantSdk.initialize(
    application = this@DemoApplication,
    apiKey = BuildConfig.API_KEY,
    environment = environment,
    timeoutSeconds = 30L,
    logLevel = KoardLogLevel.VERBOSE
)

Levels are VERBOSE, DEBUG, INFO, WARN, ERROR, and NONE. The default is DEBUG in debug builds and NONE in release, and the level applies in release builds too if you opt in. Secrets, API key and token headers, device certificates, and enrollment key material, are never logged at any level.

Check Logcat:

The SDK logs under the fixed tag KoardSDK:

adb logcat -s KoardSDK

Verify SDK version:

Check which SDK version the demo is using:

./gradlew dependencies | grep koard

Device Compatibility

Issue Possible Cause Solution
Eligibility check returns failure codes Device doesn't meet one or more requirements Inspect the error from the failed operation and address its cause (e.g., enable Google Play Protect, update Google Play Services, disable developer mode)
NFC transactions fail on a supported device Developer mode enabled Disable developer mode in Settings → Developer options
Card not reading NFC disabled in device settings Go to Settings → Connected devices → Connection preferences → NFC and ensure it's toggled on
Intermittent read failures Card positioned incorrectly Guide the customer to tap in the correct NFC zone (see table above)
Companion app not detected Visa Tap to Pay Ready app not installed Use the SDK installation flow; see installation steps
Transactions fail after app update Developer mode was re-enabled for deployment Disable developer mode after installing updates, then restart the device

Pre-Flight Checklist

Before contacting Koard support about a device that "won't take a tap" or "fails to enroll", confirm all of the following on the merchant's device:

  • Device is running Android 13 (API 33) or later
  • NFC is enabled in Settings
  • NFC and contactless payments is enabled (where present)
  • Developer mode is off
  • Automatic date and time is on
  • Google Play Protect is enabled
  • Google Play Services is installed and up to date
  • Visa Tap to Pay Ready app is installed directly from Google Play or through the optional in-app flow; see installation steps
  • Device is not rooted and is not running a custom ROM
  • Enrollment succeeds and readinessState.value.isReadyForTransactions is true before starting a tap

If every item is checked and the device still fails, gather the following before contacting support:

  • Device make, model, and Android version
  • Koard SDK version (the version of koard-android / the Koard Merchant SDK your app is built against)
  • The statusCode and statusCodeDescription from the failing KoardTransactionResponse, or the KoardErrorType from the thrown KoardException
  • A log excerpt from the time of the failure. The SDK logs to Logcat under the fixed tag KoardSDK; capture it with adb logcat -s KoardSDK. Verbosity is set once at startup via KoardMerchantSdk.initialize(..., logLevel = KoardLogLevel.VERBOSE): there is no runtime setter, and the default is NONE in release builds, so ask the merchant for a build that opts in. The SDK never logs API keys, tokens, device certificates, or enrollment key material at any level.