Skip to main content

NFC Document Verification Tutorial for Didit Android SDK

This tutorial provides a comprehensive guide to integrating NFC document verification into Android applications using the Didit Android SDK.

NFC Document Verification Tutorial for Didit Android SDK

Contents

In this guide

Jump to the part you need.

Enhanced SecurityNFC verification reads cryptographically signed data directly from ePassports and eIDs, providing a higher level of assurance than visual checks alone.

Streamlined User ExperienceAutomating data extraction via NFC reduces manual input errors and accelerates the onboarding process for users.

Compliance & Fraud PreventionUtilizing NFC Verification helps businesses meet stringent KYC/AML regulations and significantly mitigates identity fraud risks by validating document authenticity.

Didit's Seamless IntegrationDidit's Android SDK simplifies the complex process of NFC verification, offering a modular, AI-native solution with built-in liveness detection and a core KYC tier.

The Power of NFC in Identity Verification

Near Field Communication (NFC) has revolutionized identity verification, particularly for documents like ePassports and eIDs. Unlike traditional optical character recognition (OCR) that relies on visual data, NFC verification directly reads the embedded chip within these documents. This chip contains the holder's biometric data, personal information, and crucial security features, all cryptographically protected. This method offers unparalleled security, making it incredibly difficult for fraudsters to forge or tamper with identity documents.

For businesses, integrating NFC verification means a significant leap in fraud prevention and compliance. It ensures that the identity presented is not only visually valid but also digitally authentic, directly from the issuing authority. This reduces the risk of synthetic identity fraud, deepfakes, and other sophisticated attacks that might bypass less rigorous verification methods.

The user experience also benefits immensely. Instead of manually entering details or relying on potentially error-prone OCR scans, users simply tap their document to their NFC-enabled smartphone. This swift and accurate process minimizes friction during onboarding, leading to higher conversion rates and greater customer satisfaction. Didit's NFC Verification product is designed to harness these advantages, providing a robust and user-friendly solution.

Setting Up Your Android Project for Didit NFC Verification

Integrating Didit's NFC Verification into your Android application is a straightforward process, thanks to its well-documented and modular SDK. Before diving into the code, ensure your development environment meets the following requirements:

  • Android API 23+ (Android 6.0 Marshmallow)
  • Kotlin 1.9+, Gradle 8.0+
  • An NFC-capable Android device for testing.

Step-by-Step Installation:

First, you need to add the Didit SDK to your project. This involves configuring your Maven repositories and adding the SDK dependency.

1. Add Maven Repository

In your settings.gradle.kts file, ensure the Didit Maven repository is included:

dependencyResolutionManagement {
  repositories {
      google()
      mavenCentral()
      maven { url = uri("https://raw.githubusercontent.com/didit-protocol/sdk-android/main/repository") }
  }
}

2. Add Dependency

Next, in your app/build.gradle.kts file, add the Didit SDK implementation:

dependencies {
  implementation("me.didit:didit-sdk:3.2.0")
}

3. Add Packaging Exclusion

To prevent build conflicts, add this packaging exclusion within the android { } block of your app/build.gradle.kts:

android {
  packaging {
      resources {
          excludes += "META-INF/versions/9/OSGI-INF/MANIFEST.MF"
      }
  }
}

The Didit Android SDK automatically merges necessary permissions like INTERNET, ACCESS_NETWORK_STATE, CAMERA, and NFC from its manifest, simplifying your manifest configuration.

Implementing NFC Verification with Didit SDK

Once the SDK is installed, the next step is to initiate an NFC verification session. Didit's approach is developer-first, offering clean APIs for seamless integration. The process typically involves creating a verification session on your backend and then passing the session token to your Android application.

Backend Session Creation (Your Server):

Your backend will initiate a session with Didit's API. This ensures secure communication and proper workflow orchestration.

POST https://verification.didit.me/v3/session/
Headers: { "x-api-key": DIDIT_API_KEY, "Content-Type": "application/json" }
Body: { "workflow_id": DIDIT_WORKFLOW_ID, "vendor_data": "user-id" }
Response: { "session_id": "uuid", "session_token": "jwt-token", "verification_url": "...", "status": "Not Started" }

The session_token received from this response is crucial; you will send this to your Android app.

Android App Integration:

In your Android application, you'll use the DiditSdk class to handle the verification flow. The SDK supports both a full UI experience and a headless mode for custom UIs.

Option A: With Session Token from Your Backend

This is the recommended approach for orchestrating complex workflows and maintaining backend control.

import me.didit.DiditSdk

// ... inside your Activity or Fragment

val sessionToken = "YOUR_SESSION_TOKEN_FROM_BACKEND"
DiditSdk.start(this, sessionToken) { result ->
    when (result) {
        is DiditSdk.VerificationResult.Success -> {
            // Verification successful, handle the result
            Log.d("Didit", "Verification Success: ${result.sessionId}")
        }
        is DiditSdk.VerificationResult.Error -> {
            // Verification failed or was cancelled
            Log.e("Didit", "Verification Error: ${result.message}")
        }
    }
}

The SDK will guide the user through the NFC scanning process, including prompts for placing the document against the phone. It seamlessly integrates ID Verification (OCR, MRZ, barcodes), Passive & Active Liveness, and the crucial NFC Verification (ePassport/eID) to ensure a comprehensive and secure identity check.

Best Practices for a Smooth User Experience

While the Didit SDK handles much of the complexity, optimizing the user experience for NFC verification is key to successful implementation:

  • Clear Instructions: Provide clear, concise instructions to users on how to position their ePassport or eID for NFC scanning. Visual cues or animations can be very helpful.
  • Error Handling: Implement robust error handling and user feedback. If NFC scanning fails, guide the user on potential issues (e.g., device not NFC-enabled, document not properly placed).
  • Contextual Prompts: Explain why NFC verification is needed (e.g., "For enhanced security and faster verification"), building trust and reducing user hesitation.
  • Performance: NFC verification is typically fast, but ensure your app remains responsive during the process.
  • Fallback Options: While NFC is highly secure, consider offering alternative verification methods (e.g., manual upload, photo verification) for users who might have older documents or non-NFC-enabled devices, though clearly communicating the security advantages of NFC.

Didit's modular architecture allows you to easily combine NFC Verification with other powerful tools like Passive & Active Liveness detection to combat deepfakes and ensure the person presenting the document is its rightful owner. This multi-layered approach creates a formidable defense against identity fraud.

How Didit Helps

Didit is the AI-native, developer-first identity platform designed to make robust identity verification accessible and scalable. For NFC document verification, Didit's Android SDK stands out by providing a comprehensive, easy-to-integrate solution. Our NFC Verification product seamlessly reads data from ePassports and eIDs, ensuring the highest level of document authenticity. This is part of our broader ID Verification suite, which includes OCR, MRZ, and barcode scanning, making Didit a one-stop shop for document-based identity checks.

What sets Didit apart is its commitment to modularity and developer-friendliness. You can plug-and-play identity checks, orchestrating complex workflows with our no-code engine or through clean APIs. We offer a Core KYC tier with pay-per-use pricing, allowing businesses of all sizes to start verifying identities without upfront costs. Our AI-native approach ensures high accuracy and continuous improvement in fraud detection, including sophisticated liveness checks to prevent spoofing and deepfake attacks. With no setup fees and a pay-per-successful-check model, Didit provides a cost-effective and powerful solution for global identity verification needs.

Ready to Get Started?

Ready to see Didit in action? Get a free demo today.

Start verifying identities for free with Didit's free tier.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Blog questions

Who writes the Didit blog?
The Didit team. Guides reviewed by Alberto Rosas, co-founder and CEO, carry his byline. The rest are published as Didit.
Which topics does the blog cover?
Eight topics: ID verification, business verification (KYB), AML, sanctions and compliance, fraud prevention, transaction monitoring and crypto, country guides, agents and developers, and product updates.
Is the blog available in my language?
Yes, in 15 languages: English, Spanish, French, German, Brazilian and European Portuguese, Catalan, Russian, Arabic, Chinese, Japanese, Hindi, Indonesian, Korean and Swahili. Not every post is translated, so each language shows the posts it has.
Where do I find product updates?
In the changelog at /changelog/ and under the Product updates topic.
Are these posts legal advice?
No. Regulation posts explain rules; your legal team decides how they apply.
How do I find posts on one topic?
Open one of the eight topics, or search the blog.
Are posts dated?
Yes. Every post shows when it was published and when it was last updated.
Do posts link to the docs?
Developer posts link to the matching page on docs.didit.me and to the API reference.
Is the blog the same as the docs?
No. The blog explains rules, markets and product changes for a general reader, while docs.didit.me holds the integration guides and the API reference. Developer posts link the matching docs page and the API reference they describe.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.