Onfido logo home page
Watch a demo
Get in touch
Arrow back Back to guides

NFC for Document report

Start here

Some passports and identity cards contain a chip which can be accessed using Near Field Communication (NFC). In this case, Onfido can use NFC to validate the document during a check containing a Document report.

Follow this guide to:

  • set up your integration for NFC
  • create a check composed of a Document report with NFC

Please contact your Customer Success manager for additional help integrating with NFC.

Enable NFC in the Onfido SDKs

NFC is only available via the Onfido mobile SDKs. The SDK provides a set of screens to extract the information contained in the chip via NFC to verify the original document is present.

You must enable NFC in your app and the SDK in order to complete a Document report with NFC.

App build

iOS

  • Add Near Field Communication Tag Reading capability in your app target. You can follow the steps in Apple's documentation
  • Include the following entries in your app target's Info.plist file
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
  <string>12FC</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
  <string>A0000002471001</string>
  <string>A0000002472001</string>
  <string>00000000000000</string>
  <string>D2760000850101</string>
</array>

Configure the SDK

iOS

Pass the following method to invoke NFC in the iOS SDK.

let config = try! OnfidoConfig.builder()
    .withSDKToken("<YOUR_SDK_TOKEN_HERE>")
    .withDocumentStep()
    .withPassportNFCReadBetaFeatureEnabled()
    .build()
ONFlowConfigBuilder *configBuilder = [ONFlowConfig builder];

[configBuilder withSdkToken:@"YOUR_SDK_TOKEN_HERE"];
[configBuilder withDocumentStep];
[configBuilder withPassportNFCReadBetaFeatureEnabled];

NSError *configError = NULL;
ONFlowConfig *config = [configBuilder buildAndReturnError:&configError];

Upgrade to API v3.2

You must upgrade your backend to use API v3.2 onwards in order to consume the NFC breakdown and sub-breakdowns in the Document report.

NFC is not available in earlier versions of the Onfido API. Please refer to our API versioning policy.

Create a check containing a Document report with NFC

Once you have enabled NFC in the Onfido SDK and upgraded to API v3.2 onwards, you can create a check containing a Document report with NFC.

Start the SDK flow

The SDK flow for a Document report with NFC includes both the standard document step capture screens and additional NFC scan screens.

All users will first be presented with the document capture screens. The additional NFC screens will then be presented to the user if Onfido supports NFC for the document type and country selected. Otherwise, the user will finish the SDK flow after the document capture step and no NFC scan will be completed.

Document IDs

On success the SDK will return a callback which contains an array of document IDs. The document IDs will include:

  • the document front image
  • the document back image (if the document has 2 sides, for example an ID card)
  • the NFC media (if the document is supported for NFC and an NFC scan has completed successfully)

You need to extract all the document IDs to use when creating a check on the backend.

iOS
func getDocumentIds(fromResults results: [OnfidoResult]) -> [String]? {
        return results.map({ onfidoResult -> [String] in
            switch onfidoResult {
            case .document(let documentResult):
                guard let nfcMediaId = documentResult.nfcMediaId else {
                    return []
                }
                var ids: [String] = [documentResult.front.id]
                if let backId = documentResult.back?.id {
                    ids.append(backId)
                }
                ids.append(nfcMediaId)
                return ids
            default:
                return []
            }
        }).first
    }

OnfidoFlow(...)
    .with(responseHandler: { response in 
        switch response {
            case .success(let results):
                if let documentIds = getDocumentIds(fromResults: results) {
                   // USE DOCUMENT IDS FOR CHECK CREATION
                }
            ...
        }
    })

Create a check

On success, create a check on your backend.

Example for an NFC supported passport:

curl -X POST https://api.eu.onfido.com/v3.2/checks \
  -H 'Authorization: Token token=<YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "applicant_id": "<APPLICANT_ID>",
  "report_names": ["document"],
  "document_ids": ["<DOCUMENT_ID_FRONT>", "<NFC_MEDIA_ID>"] 
}'
Parameter Notes
applicant_id (required) Specifies the applicant for the check.
report_names (required) The report name. NFC is available as part of the primary Document report option.
document_ids (required) Array including all the document IDs returned in the SDK success callback. This could include up to 3 IDs for the document front side, back side and NFC media.

Note: document_ids is only a required parameter for a Document report with NFC as you need to specify the NFC media ID at check creation. For a standard Document report, document_ids is an optional parameter.

For more details on how to create a check, see our quick start guide for iOS, Android SDKs.

Result handling

NFC breakdown

The issuing authority breakdown captures the result of the NFC scan. It asserts whether data on the document matches the issuing authority data and uses the following sub-breakdowns:

  • nfc_active_authentication - asserts whether the document NFC chip is original or cloned
  • nfc_passive_authentication - asserts whether the document NFC chip was tampered

Result logic

The issuing_authority breakdown can return a result of clear, consider or null:

The result is clear if the NFC chip was not tampered and, if applicable, the NFC chip is original. In this case, the visual authentication, image integrity and data consistency checks will not be performed and those breakdowns will be null.

The result is consider if the NFC chip is not authentic. This is mapped to a suspected sub-result for the Document report. In this case, the visual authentication, image integrity and data consistency checks will not be performed and those breakdowns will be null.

The result is null if NFC is not available or inconclusive. In this case, a standard Document report will be completed instead.

Configuration options

You can configure your account to always trigger Visual Document Verification if nfc_active_authentication is returned as null (even if nfc_passive_authentication is clear). In this case, regardless of the document being processed, the visual authentication, image integrity and data consistency checks will be performed and the results returned in the breakdowns.

Please contact your Customer Success manager to enable this.

Properties

In the Document check properties an nfc object is returned which includes the NFC extracted document data.

If NFC is not available, no data will be extracted, hence the nfc object will not be returned.

Onfido

Our solutions

Onfido uses 256-bit SSL encryption 100% of the time on every device.

BSI ISO/IEC27001

Onfido has been certified by BSI to ISO 27001 under certificate number IS 660122.

© Onfido™, 2021. All rights reserved.
Company Registration Number: 07479524.