Most passport SDK integration tutorials stop at "add the dependency and call the scan method." That leaves developers guessing about permissions, result parsing, error states, and the gap between a demo that works on one device and a production flow that handles real users across hundreds of passport types.
This is a complete passport SDK integration tutorial — not a quickstart. It covers iOS (Swift), Android (Kotlin), and Web (JavaScript) from dependency installation through to a verified, structured result you can pass to your backend. Each platform section follows the same five-step pattern so you can implement one platform now and add another later without relearning the flow.
Before picking a specific vendor, read our Passport SDK Selection guide — it covers the eight questions that determine whether an SDK fits your compliance, accuracy, and deployment requirements. The integration steps below assume you have already made that choice.
What a Passport SDK Actually Does
A passport SDK handles two distinct capture paths that your integration must support:
- MRZ scanning: The camera reads the Machine Readable Zone — the two (or three) lines of encoded text at the bottom of the passport's data page — and parses it into structured fields: document number, surname, given names, nationality, date of birth, expiry date, and check digits.
- NFC chip reading: On NFC-capable devices, the SDK reads the contactless chip embedded in e-passports, extracts the signed data groups (biography, facial image), and runs Passive Authentication and Chip Authentication to verify the chip has not been tampered with or cloned.
Both paths return the same structured result object. Your integration flow should enable MRZ scanning always, and gate NFC reading on device capability. The SDK's architecture — on-device processing vs. cloud API — also affects where you call it and how you handle connectivity. For a deeper look at that trade-off, see our article on Passport SDK architecture, scalability and security.
| Capability | MRZ Scan | NFC Chip Read |
|---|---|---|
| Works offline | ✓ Yes | ✓ Yes (cert bundle required) |
| Requires NFC hardware | ✓ No | ✗ Yes |
| Detects data tampering | ✗ No | ✓ Yes (Passive Auth) |
| Detects chip cloning | ✗ No | ✓ Yes (Chip Auth) |
| Returns facial image | ✗ No (OCR only) | ✓ Yes (DG2) |
| Supported on all e-passports | ✓ Yes | ✓ Yes (post-2006 biometric) |
iOS Integration (Swift)
Install via CocoaPods
Run pod install and open the generated .xcworkspace. If you prefer Swift Package Manager, add the SDK's repository URL in Xcode under File → Add Package Dependencies.
Configure Info.plist permissions
Also enable the Near Field Communication Tag Reading capability in your Xcode target's Signing & Capabilities tab. Without the entitlement, NFC calls will fail silently at runtime.
Initialise the SDK
Launch the scanner and handle the result
Send the result to your backend
Android Integration (Kotlin)
Add the dependency via Gradle
Declare permissions in AndroidManifest.xml
Setting android:required="false" on the NFC feature keeps your app installable on non-NFC devices. Check for NFC availability at runtime before enabling chip reading.
Initialise the SDK in Application
Launch the scanner Activity
Request camera permission at runtime
Web Integration (JavaScript / TypeScript)
The Web SDK ships as a WebAssembly module and runs entirely in the browser. MRZ scanning uses the device's camera via the MediaDevices API. NFC chip reading on the web uses the Web NFC API, currently supported in Chrome on Android only.
Install via npm
Or load from a CDN for a script-tag integration:
Add a mount target to your HTML
Initialise and launch
Parse and submit the result
HTTPS is mandatory
Browsers block camera and NFC access on non-secure origins. Your integration page must be served over HTTPS. localhost is treated as secure during development and does not require a certificate.
Cross-Platform: React Native and Flutter
If your app targets both iOS and Android from a single codebase, use the official React Native or Flutter plugin rather than writing separate native integrations.
Production Checklist Before You Ship
A working prototype and a production-ready integration are not the same thing. Before you go live, confirm each of the following:
- API key scoped to production: Development and production keys should be separate. Production keys should be stored in a secrets manager, not in your source code.
- Camera permission rationale: On Android, always show a rationale dialog before requesting the permission if the user has previously denied it. On iOS, you only get one prompt — make the Info.plist string descriptive.
- Error states handled for every code: At minimum: CAMERA_DENIED, SCAN_TIMEOUT, MRZ_NOT_FOUND, NFC_NOT_SUPPORTED, NFC_READ_ERROR, and CHIP_AUTH_FAILED. Map each to a user-facing message that explains the next step.
- NFC gracefully disabled on unsupported devices: Fall back to MRZ-only mode on devices without NFC hardware. Do not hard-require chip reading unless your compliance tier demands it.
- Backend validates the SDK token: The SDK returns a signed result token. Your backend should verify the token's signature using the SDK provider's public key before trusting any of the extracted data. Never trust raw client-side data without server-side verification.
- Certificate store is up to date: If you ship a bundled certificate store for offline NFC authentication, include a background update mechanism or plan for app releases that refresh it. An outdated store will reject legitimate passports as their signing certificates age out.
- Tested on real passports: Test with passports from at least five different issuing countries, including both pre-2006 non-biometric passports (MRZ only) and post-2006 e-passports (NFC capable). Edge cases in name formatting and date encoding vary significantly across issuing authorities.
For a deeper look at how on-device and cloud processing architectures affect production reliability, scalability, and compliance, see our article on Cloud vs. On-Premise Passport SDK deployment models.
Common Integration Mistakes
These are the issues that consistently appear in developer forums after initial integration.
- Calling the SDK before permission is granted: The SDK will throw or return an error immediately. Always confirm camera (and NFC, if used) permission before launching the scanner, even if you think the user already granted it.
- Mounting the scanner into a zero-height container: On the web, if the mount container has no explicit height, the camera feed will not render. Always set an explicit height or aspect-ratio on the container element.
- Treating MRZ check digit failure as a scan error: A failed check digit means the OCR read one or more characters incorrectly, not that the passport is invalid. The right response is to restart the scan, not to reject the document or surface an error to the user.
- Not handling NFC_NOT_SUPPORTED on Android: Even if the device has NFC hardware, the adapter can be disabled by the user. Check adapter state at runtime, not just hardware availability.
- Storing raw passport data in client storage: Do not persist MRZ strings, document numbers, or facial images in localStorage, SharedPreferences, or NSUserDefaults. Pass the result to your backend immediately and discard it from device memory.
What to Do After Integration: Choosing the Right SDK Features
Once the basic integration is working, the next decision is which SDK features to enable based on your specific use case. Not every deployment needs NFC chip reading, liveness detection, or document fraud checks. Enabling features you do not need increases friction for your users without improving your security posture.
The key questions are: what tier of identity assurance does your regulatory context require, and what is the minimum friction path that meets it? Our Passport SDK Selection guide walks through that decision systematically — covering accuracy benchmarks, compliance requirements, and the features that actually matter for each use case.
For teams considering whether their architecture should run processing on-device or in the cloud, the trade-offs between latency, data residency, offline capability, and certificate management are covered in our piece on Passport SDK architecture and scalability.
Frequently Asked Questions
How long does a passport SDK integration actually take?
For a well-documented SDK with native packages available via CocoaPods, Gradle, or npm, a working prototype that scans a passport and returns structured data typically takes under 30 minutes. A production-ready integration — with error handling, UI polish, and server-side verification calls — takes one to three developer days depending on platform and the complexity of your existing onboarding flow.
Does a passport SDK work offline?
MRZ scanning and data extraction can run entirely on-device with no network call. NFC chip reading also runs on-device. However, certificate chain validation for e-passport authentication requires an up-to-date certificate store — most SDKs handle this by bundling a periodically updated certificate package or by making a background sync call, rather than requiring a live connection at scan time.
Which platforms does a passport SDK support?
Production-grade passport SDKs support iOS (Swift/Objective-C), Android (Kotlin/Java), and Web (JavaScript/TypeScript via WebAssembly). React Native and Flutter wrappers are also available from most vendors, exposing the native SDK through a cross-platform bridge.
What permissions does a passport SDK need?
Camera permission is required for MRZ scanning on all platforms. NFC permission is required if you enable chip reading. Web integrations require the user to grant camera access via the browser permission prompt; NFC on the web requires Chrome on Android with the Web NFC API.
Can I integrate a passport SDK into a React Native or Flutter app?
Yes. Most passport SDK vendors publish official React Native and Flutter plugins that wrap the underlying native SDK. The plugin exposes a JavaScript or Dart API that mirrors the native interface, so you can call scanPassport() from cross-platform code while the native camera and NFC hardware handles the actual scanning.
Conclusion
A passport SDK integration follows the same five-step pattern on every platform: install the dependency, declare permissions, initialise with your API key, launch the scanner, and handle the structured result. The code in this guide gives you a working starting point for iOS, Android, and Web, and covers the production concerns — error handling, permission flows, backend verification, and certificate management — that the quickstart tutorials leave out.
The underlying complexity of MRZ parsing, NFC protocol negotiation, and e-passport authentication is handled entirely by the SDK. What your application code needs to do is configure it, launch it, receive the result, and make a good decision about what comes next in your onboarding flow.
If you are still evaluating which SDK to build on, start with our Passport SDK Selection guide before writing any integration code. Choosing the right SDK before you integrate is far less expensive than switching after you have built against the wrong one.