Skip to main content
Near Field Communication (NFC) tags can be cards, phones, bracelets, or similar. They can store data and are commonly used for contactless payments, loyalty programs, festival entrance, and more. By sending a Terminal API card acquisition request to your Adyen payment terminal, you can identify the type of NFC tag, or read and write data to it. If you prefer to use a dedicated Android app for specific NFC operations, it is possible to hide the Adyen UI and keep your app’s UI in the foreground. You can also create a session to perform multiple requests as a single user interaction. To understand how you can use this, here are some examples:
  • Enroll shoppers in a loyalty program.
  • Identify a customer when entering an area such as festival grounds or a parking garage.
  • Check the balance and top up NFC tags such as loyalty and transport cards, or festival tags used to pay for drinks.
  • Define multiple behaviours of the NFC tag. For example, use the tag to enter one event and reuse it to pay for drinks at a different event.

Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

How it works

To use NFC tags on Adyen payment terminals:
  1. Make a card acquisition request to identify, read, or write to an NFC tag. For more complex use cases that require multiple requests, see Create a session.
  2. The terminal prompts the user to present their NFC tag or NFC-enabled card.
  3. The user presents their NFC tag by tapping, inserting, or swiping.
  4. The terminal makes one or multiple read/write requests to the NFC tag.
    While this is going on, the terminal shows the One moment loading screen.
    If you want to use a dedicated Android app to process NFC operations, it is possible to hide the Adyen UI and keep your app’s UI in the foreground.

Identify the NFC tag type

You can use the card acquisition request to get the unique identifier and the type of the NFC tag. You can use this identifier, for example, to check if the NFC tag exists in your system or if it is still valid.
  1. Create an Operation JSON object with Operation.Type: NFCReadUID: Operation JSON object
  2. Encode the Operation JSON object to Base64. You will pass the resulting string in SaleData.SaleToPOIData. Converted to a Base64-encoded string
  3. Make a card acquisition request, specifying:
    • The standard SaleToPOIRequest.MessageHeader object, with MessageClass set to Service and MessageCategory set to CardAcquisition.
    The following example shows a card acquisition request to identify the NFC tag. Request to identify the NFC tag
  4. In the AdditionalResponse of the CardAcquisitionResponse note:
    • NFC.uid: The unique identifier of the NFC tag.
    • NFC.variant: The type of the NFC tag, for example mf_classic for MIFARE Classic.
    Response identifying the NFC tag
    After you have identified the NFC tag, the loading screen continues to show until you send an enable service request (see the next step).
  5. To stop the loading screen, make an enable service request, specifying:
    • The standard SaleToPOIRequest.MessageHeader object, with MessageClass set to Service and MessageCategory set to EnableService.
    The following example is the basic request, without the DisplayOutput object, to stop the card acquisition flow. Basic request to stop the card acquisition

Read data

NFC tags have multiple parts that can store data. Because the data structure is different for every NFC tag type, the request needs to specify where to read the data from. For some tags, you need to include the key to read data from a sector, aid, orpage.
Select a tab to see the parameters that you need to specify to read data from MIFARE Classic, MIFARE DESFire, or MIFARE Ultralight.
  1. Create an Operation JSON object specifying: On Castles Android terminals you cannot use keyType: b due to a limitation from Castles.
    • keyId: Specifies what unique key for the specified keyType to use to access a sector. Can be any positive numerical value. |
    Structure of Operation object for read data request - MIFARE Classic
  2. Encode the Operation JSON object to Base64. You will pass the resulting string in SaleData.SaleToPOIData. Converted to a Base64-encoded string
  3. Make a card acquisition request, specifying:
    • The standard SaleToPOIRequest.MessageHeader object, with MessageClass set to Service and MessageCategory set to CardAcquisition.
    • The CardAcquisitionRequest.SaleData object with:
    The following example shows a card acquisition request to read data from sectors 1 and 2 on a MifareClassic NFC tag: Read data request - MIFARE Classic
  4. When the card acquisition succeeds, in the AdditionalResponse of the CardAcquisitionResponse note:
    • NFC.data: the data from the specified sectors.
      • For a single sector, the data shows as NFC.data=afafafafafafafafafa….
      • For multiple sectors, the data from each sector shows as value of the NFC.data for that sector, for example: NFC.data.S01=afafafafafafafafafa, NFC.data.S02=2222222222222222.
    • NFC.status: the status of the read action for every sector, for example NFC.status=s01.OKs02.OKS03.AUTH_ERROR.
    • NFC.uid: the unique identifier of the NFC tag.
    • NFC.variant: the type of the NFC tag, in this case MIFARE Classic.
    Read data response - MIFARE Classic
    After you have read the specified sectors on the NFC tag, the loading screen continues to show until you send an
    enable service request (see the next step).
  5. To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
    • The standard SaleToPOIRequest.MessageHeader object, with MessageClass set to Service and MessageCategory set to EnableService.
    • EnableServiceRequest with:
    The following example is the basic request, without the DisplayOutput object, to stop the card acquisition flow. Basic request to cancel the card acquisition data