- 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.| Requirement | Description |
|---|---|
| Integration type | A Terminal API integration with payment terminals. |
| Hardware | The payment terminal model must support the NFC tags that you want to use. |
| Limitations | Note the following: Writing MIFARE DESFire and reading and writing MIFARE Ultralight is supported only on Android terminals. Engage terminals can only read/write to MIFARE Ultralight C pages if the pages are unlocked. Hiding the Adyen UI for stored value cards and identity cards is only supported with terminal models S1E, S1E2L, S1F2, and S1U2 on software version 1.114 or later. See the supported NFC tag types and terminal models. |
| Setup steps | Before you begin, provide our Support Team with the following information so that the team can create your NFC configuration: The type of NFC tag you want to use. If your NFC tags have cryptographic keys: the keys you want to use to access data. Whether you want to hide the Adyen UI and instead keep your own UI in the foreground if you use a dedicated Android app for NFC operations. |
How it works
To use NFC tags on Adyen payment terminals:- 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.
- The terminal prompts the user to present their NFC tag or NFC-enabled card.
- The user presents their NFC tag by tapping, inserting, or swiping.
-
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.-
Create an
OperationJSON object withOperation.Type: NFCReadUID: Operation JSON object{ "Operation":[ { "Type":"NFCReadUID" } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkVUlEIgogICAgICAgIH0KICAgIF0KfQ== -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition.Parameter Required Description ProtocolVersion
3.0 MessageClass
Service MessageCategory
CardAcquisition MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
The CardAcquisitionRequest.SaleData object with:Parameter Required Description SaleTransactionID
An object with: TransactionID: Your reference to identify the transaction. We recommend using a unique value.TimeStamp: The date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when getting theUIDof the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"1020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"02072", "TimeStamp":"2020-01-07T14:14:04+00:00" }, "SaleToPOIData":"ewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkVUlEIgogICAgICAgIH0KICAgIF0KfQ==" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
In the
AdditionalResponseof 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.
After you have identified the NFC tag, the loading screen continues to show until you send an enable service request (see the next step).{ "SaleToPOIResponse":{ "CardAcquisitionResponse":{ "POIData":{ "POIReconciliationID": "1000", "POITransactionID":{ "TimeStamp": "2022-10-10T12:50:31.000Z", "TransactionID": "CglQ001665406231000" } }, "PaymentInstrumentData":{ "CardData": {}, "PaymentInstrumentType": "Card" }, "Response":{ "AdditionalResponse": "...NFC.uid=96924E37...NFC.variant=mf_classic...", "Result": "Success" }, "SaleData":{ "SaleTransactionID":{ "TimeStamp": "2022-10-03T10:56:42.198Z", "TransactionID": "729" } } }, "MessageHeader": {...} } } -
To stop the loading screen, make an enable service request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService.Parameter Required Description ProtocolVersion
3.0 MessageClass
Service MessageCategory
EnableService MessageType
Request ServiceID
Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal ( POIID) being used.SaleID
Your unique ID for the POS system component to send this request from. POIID
The unique ID of the terminal to send this request to. Format: [device model]-[serial number].
The EnableServiceRequest object with:Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have an NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to stop the card acquisition{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
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 asector, 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.
- MIFARE Classic - read
- MIFARE DESFire - read
- MIFARE Ultralight - read
- MIFARE Classic - write
- MIFARE DESFire - write
- MIFARE Ultralight - write
-
Create an
OperationJSON object specifying:On Castles Android terminals you cannot useParameter Required Description Type
NFCRead: Reads data from the specified sector. Variant
MifareClassic: The type of NFC tag. NFCData
If you leave the NFCDataarray empty, the terminal will try to read all sectors.An array with:sector: Specifies what sector on MifareClassic to read from.keyType: Specifies what key is used to access a sector, a (default) or b.keyType: b due to a limitation from Castles.keyId: Specifies what unique key for the specifiedkeyTypeto use to access a sector. Can be any positive numerical value. |
{ "Operation":[ { "Type":"NFCRead", "Variant":"MifareClassic", "NFCData":[ { "sector":1, "keyType":"a", "keyId":1 }, { "sector":2, "keyType":"b", "keyId": 2 } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAiT3BlcmF0aW9uIjpbCiAgICAgIHsKICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVDbGFzc2ljIiwKICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAic2VjdG9yIjoxLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImEiLAogICAgICAgICAgICAgICAia2V5SWQiOjEKICAgICAgICAgICAgfSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAic2VjdG9yIjoyLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImIiLAogICAgICAgICAgICAgICAia2V5SWQiOjIKICAgICAgICAgICAgfQogICAgICAgICBdCiAgICAgIH0KICAgXQp9 -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when reading the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"282", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "SaleToPOIData":"ewogICAiT3BlcmF0aW9uIjpbCiAgICAgIHsKICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVDbGFzc2ljIiwKICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAic2VjdG9yIjoxLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImEiLAogICAgICAgICAgICAgICAia2V5SWQiOjEKICAgICAgICAgICAgfSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAic2VjdG9yIjoyLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImIiLAogICAgICAgICAgICAgICAia2V5SWQiOjIKICAgICAgICAgICAgfQogICAgICAgICBdCiAgICAgIH0KICAgXQp9" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof 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.datafor that sector, for example: NFC.data.S01=afafafafafafafafafa, NFC.data.S02=2222222222222222.
-
NFC.status: the status of the read action for everysector, 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.
After you have read the specified sectors on the NFC tag, the loading screen continues to show until you send an{ "SaleToPOIResponse":{ "CardAcquisitionResponse":{ "POIData":{ "POIReconciliationID":"1000", "POITransactionID":{ "TimeStamp":"2022-10-17T11:35:04.000Z", "TransactionID":"CglQ001666006504012" } }, "PaymentInstrumentData":{ "CardData":{ }, "PaymentInstrumentType":"Card" }, "Response":{ "AdditionalResponse":"tid=47353332&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&store=YourStore&iso8601TxDate=2022-10-17T11%3a35%3a04.733Z&posOriginalAmountValue=0&txtime=13%3a35%3a04&NFC.data.S01=AFAFAFAFAFAFAFAF&NFC.uid=96924E37&txdate=17-10-2022&NFC.data.S02=2222222222222222&merchantReference=868&posadditionalamounts.originalAmountCurrency=EUR&NFC.ref=mifareClassicCard&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&posAmountCashbackValue=0&NFC.variant=mf_classic&posEntryMode=CLESS_SWIPE&NFC.status=S01.OKS02.OK&posAuthAmountValue=0", "Result":"Success" }, "SaleData":{ "SaleTransactionID":{ "TimeStamp":"2022-10-03T10:56:42.966Z", "TransactionID":"868" } } }, "MessageHeader":{ "MessageCategory":"CardAcquisition", "MessageClass":"Service", "MessageType":"Response", "POIID":"V400m-346403161", "ProtocolVersion":"3.0", "SaleID":"POSSystemID12345", "ServiceID":"40" } } }
enable service request (see the next step). -
-
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
-
Create an
OperationJSON object specifying:Structure of Operation object for read data request - MIFARE DESFireParameter Required Description Variant
MifareDesfire: the type of NFC tag. NFCData
An array with: aid: the application ID to read from.keyId: the ID of the key used to access the specifiedaid.fileIds: the files inside theaidto read.fileOffsets: the byte in the specified file from which to start reading data.fileLengths: the number of bytes to read, starting from the byte specified infileOffset. To read all bytes in the file, set to 0.{ "Operation":[ { "Type":"NFCRead", "Variant":"MifareDesfire", "NFCData":[ { "aid":"7f21f5", "keyId":1, "fileIds":[1], "fileOffsets":[0], "fileLengths":[0] } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVEZXNmaXJlIiwKICAgICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYWlkIjoiN2YyMWY1IiwKICAgICAgICAgICAgICAgICAgICAia2V5SWQiOjEsCiAgICAgICAgICAgICAgICAgICAgImZpbGVJZHMiOlsxXSwKICAgICAgICAgICAgICAgICAgICAiZmlsZU9mZnNldHMiOlswXSwKICAgICAgICAgICAgICAgICAgICAiZmlsZUxlbmd0aHMiOlswXQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXQp9 -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when reading the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
aid7f21f5 on a MifareDesfire NFC tag: Read data request - MIFARE DESFire{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"282", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer", "SaleToPOIData":"ewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVEZXNmaXJlIiwKICAgICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAiYWlkIjoiN2YyMWY1IiwKICAgICAgICAgICAgICAgICAgICAia2V5SWQiOjEsCiAgICAgICAgICAgICAgICAgICAgImZpbGVJZHMiOlsxXSwKICAgICAgICAgICAgICAgICAgICAiZmlsZU9mZnNldHMiOlswXSwKICAgICAgICAgICAgICAgICAgICAiZmlsZUxlbmd0aHMiOlswXQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXQp9" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof the CardAcquisitionResponse note:-
NFC.data: the data from the specifiedaid.- For a single
aid, the data shows as NFC.data=00000000000000000000001234567890. - For multiple
aidfields andfileIds, the data from eachaidshows as value of theNFC.datafor thataidandfileIds: NFC.data.7f21f5.F01=00000000000000000000001234567890.
- For a single
-
NFC.status: the status of the read action for everyaid, for example NFC.status=7f21f5.OK. -
NFC.uid: the unique identifier of the NFC tag. -
NFC.variant: the type of the NFC tag, in this case MIFARE DESFire.
After you have read the specified{ "SaleToPOIResponse":{ "CardAcquisitionResponse":{ "POIData":{ "POIReconciliationID":"1000", "POITransactionID":{ "TimeStamp":"2022-10-18T12:50:17.000Z", "TransactionID":"CglQ001666097417005" } }, "PaymentInstrumentData":{ "CardData":{ }, "PaymentInstrumentType":"Card" }, "Response":{ "AdditionalResponse":"tid=47353332&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&store=YourStore&iso8601TxDate=2022-10-18T12%3a50%3a17.811Z&posOriginalAmountValue=0&txtime=14%3a50%3a17&NFC.uid=04584882D96B80&txdate=18-10-2022&NFC.data=00000000000000000000001234567890&merchantReference=605&posadditionalamounts.originalAmountCurrency=EUR&NFC.ref=desfireCard&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&posAmountCashbackValue=0&NFC.variant=mf_desfire&posEntryMode=CLESS_SWIPE&NFC.status=7f21f5.OK&posAuthAmountValue=0", "Result":"Success" }, "SaleData":{ "SaleTransactionID":{ "TimeStamp":"2022-10-03T10:56:42.966Z", "TransactionID":"605" } } }, "MessageHeader":{ "MessageCategory":"CardAcquisition", "MessageClass":"Service", "MessageType":"Response", "POIID":"V400m-347353332", "ProtocolVersion":"3.0", "SaleID":"POSSystemID12345", "ServiceID":"946" } } }aidon the NFC tag, the loading screen continues to show until you send an enable service request (see the next step). -
-
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
MIFARE Ultralight is an NFC tag with lower security standards. The data is segmented into pages instead of sectors. With the Ultralight C and Ultralight AES variants, pages can be locked with a key. For example: If pages are locked starting at page 16, then reading/writing to pages 16 - 40 requires specifying a key, and pages 0 - 15 do not require a key.Engage terminals can only read/write to unlocked MIFARE Ultralight C pages.
Select a tab to see the parameters that you need to specify to write data to MIFARE Classic, MIFARE DESFire, or MIFARE Ultralight.
-
Create an
OperationJSON object specifying:Structure of Operation object for read data request - MIFARE UltralightParameter Required Description Type
NFCRead: reads data from the specified page. Variant
The type of NFC tag used: MifareUltralight, MifareUltralightC, or MifareUltralightAES. NFCData
If you leave the NFCDataarray empty, the terminal will try to read all pages.An array with:pageOffset: the page from which to start reading data.numberOfPages: the number of pages to read, starting from the page specified inpageOffset.ultralightCKey: required only for the Ultralight C variant. HEX-encoded key used to authenticate the card. If you do not provide a key, the default one is used:49454D4B41455242214E4143554F5946.ultralightAESKey: required only for the Ultralight AES variant. HEX-encoded key used to authenticate the card. If you do not provide a key, the default one is used:00000000000000000000000000000000.ultralightAESKeyId: optional for the Ultralight AES variant. The key that specifies what part of the card’s memory to access. Possible values: 0: (default)DataProtKeyauthenticates the card and accesses protected user memory and theUID. 1:UIDRetrKeyauthenticates the card and retrieves theUIDand theECDSAsignature.{ "Operation":[ { "Type":"NFCRead", "Variant":"MifareUltralight", "NFCData":[ { "pageOffset":"4", "numberOfPages":"2" } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVVbHRyYWxpZ2h0IiwKICAgICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAicGFnZU9mZnNldCI6IjQiLAogICAgICAgICAgICAgICAgICAgICJudW1iZXJPZlBhZ2VzIjoiMiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ== -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when reading the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"282", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer", "SaleToPOIData":"ewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNSZWFkIiwKICAgICAgICAgICAgIlZhcmlhbnQiOiJNaWZhcmVVbHRyYWxpZ2h0IiwKICAgICAgICAgICAgIk5GQ0RhdGEiOlsKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAicGFnZU9mZnNldCI6IjQiLAogICAgICAgICAgICAgICAgICAgICJudW1iZXJPZlBhZ2VzIjoiMiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ==" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof the CardAcquisitionResponse note:NFC.data: the data from the specified page, such as NFC.data.P05=0F2AF6C4….NFC.status: the status of the read action for everypage, for example NFC.status=P04.OK.NFC.uid: the unique identifier of the NFC tag.NFC.variant: the type of the NFC tag, in this case MIFARE Ultralight.
After you have read the specified page on the NFC tag, the loading screen continues to show until you send an{ "SaleToPOIResponse": { "CardAcquisitionResponse": { "POIData": { "POIReconciliationID": "1000", "POITransactionID": { "TimeStamp": "2022-10-18T13:05:12.000Z", "TransactionID": "CglQ001666098312006" } }, "PaymentInstrumentData": { "CardData": {}, "PaymentInstrumentType": "Card" }, "Response": { "AdditionalResponse": "tid=47353332&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&store=YourStore&iso8601TxDate=2022-10-18T13%3a05%3a12.508Z&posOriginalAmountValue=0&txtime=15%3a05%3a12&NFC.data.P04=140BE261&NFC.uid=04DDECD2FA7280&txdate=18-10-2022&NFC.data.P05=0F2AF6C4&merchantReference=847&posadditionalamounts.originalAmountCurrency=EUR&NFC.ref=desfireCard&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&posAmountCashbackValue=0&NFC.variant=mf_ultralight_ev1&posEntryMode=CLESS_SWIPE&NFC.status=P04.OKP05.OK&posAuthAmountValue=0", "Result": "Success" }, "SaleData": { "SaleTransactionID": { "TimeStamp": "2022-10-03T10:56:42.966Z", "TransactionID": "847" } } }, "MessageHeader": { "MessageCategory": "CardAcquisition", "MessageClass": "Service", "MessageType": "Response", "POIID": "V400m-347353332", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "676" } } }
enable service request (see the next step). -
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
Write 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 thesector, aid, or page where to write the data to.Select a tab to see the parameters that you need to specify to write data to MIFARE Classic, MIFARE DESFire, or MIFARE Ultralight.
-
Create an
OperationJSON object specifying:On Castles Android terminals you cannot useParameter Required Description Type
NFCWrite: writes data to the specified sector. Variant
MifareClassic: specifies the type of NFC tag used. NFCData
If you leave the NFCDataarray empty when trying to write, the response will return theUIDand thevariantbut will not write to the card.An array specifying:sector: specifies the sector to write to.keyType: specifies whatkeyis used to write to a sector, a (default) or b.keyType: b due to a limitation from Castles.keyId: specifies what unique key for the specifiedkeyTypeto use to access a sector. Can be any positive numerical value.data: data to write in the specified sector. | |ExpectedUid|
| Specifies the UIDof the NFC tag to which you want to write the data. If theUIDof the presented NFC tag is different from theExpectedUid, the request fails andWRONG_CARDis returned in theAdditionalResponse. If passed without a value, the parameter is ignored. |
{ "Operation":[ { "Type":"NFCWrite", "Variant":"MifareClassic", "NFCData":[ { "sector":1, "data":"afafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafaf" }, { "sector":2, "data":"afafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafafaf", "keyType":"b", "keyId":1 } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAiT3BlcmF0aW9uIjpbCiAgICAgIHsKICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlQ2xhc3NpYyIsCiAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgInNlY3RvciI6MSwKICAgICAgICAgICAgICAgImRhdGEiOiJhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWYiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgInNlY3RvciI6MiwKICAgICAgICAgICAgICAgImRhdGEiOiJhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWYiLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImIiLAogICAgICAgICAgICAgICAia2V5SWQiOjEKICAgICAgICAgICAgfQogICAgICAgICBdCiAgICAgIH0KICAgXQp9 -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when writing to the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"283", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer", "SaleToPOIData":"ewogICAiT3BlcmF0aW9uIjpbCiAgICAgIHsKICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlQ2xhc3NpYyIsCiAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgInNlY3RvciI6MSwKICAgICAgICAgICAgICAgImRhdGEiOiJhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWYiCiAgICAgICAgICAgIH0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgInNlY3RvciI6MiwKICAgICAgICAgICAgICAgImRhdGEiOiJhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWZhZmFmYWYiLAogICAgICAgICAgICAgICAia2V5VHlwZSI6ImIiLAogICAgICAgICAgICAgICAia2V5SWQiOjEKICAgICAgICAgICAgfQogICAgICAgICBdCiAgICAgIH0KICAgXQp9" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof the CardAcquisitionResponse note:-
NFC.data: the data written to 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.datafor that sector, for example: NFC.data.S01=afafafafafafafafafa, NFC.data.S02=2222222222222222.
-
NFC.status: the status of the write action for everysector, 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.
After you write to the specified sectors on the NFC tag, the loading screen continues to show until you send an{ "SaleToPOIResponse":{ "CardAcquisitionResponse":{ "POIData":{ "POIReconciliationID":"1000", "POITransactionID":{ "TimeStamp":"2022-10-18T08:17:51.000Z", "TransactionID":"CglQ001666081071002" } }, "PaymentInstrumentData":{ "CardData":{ }, "PaymentInstrumentType":"Card" }, "Response":{ "AdditionalResponse":"tid=47353332&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&store=YourStore&iso8601TxDate=2022-10-18T08%3a17%3a51.591Z&posOriginalAmountValue=0&txtime=10%3a17%3a51&NFC.uid=96924E37&txdate=18-10-2022&merchantReference=889&posadditionalamounts.originalAmountCurrency=EUR&NFC.ref=mifareClassicCard&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&NFC.data.1=AFAFAFAFAFAFAFAF&posAmountCashbackValue=0&NFC.data.2=AFAFAFAFAFAFAFAF&NFC.variant=mf_classic&posEntryMode=CLESS_SWIPE&NFC.status=S01.OKS02.OK&posAuthAmountValue=0", "Result":"Success" }, "SaleData":{ "SaleTransactionID":{ "TimeStamp":"2022-10-03T10:56:42.966Z", "TransactionID":"889" } } }, "MessageHeader":{ "MessageCategory":"CardAcquisition", "MessageClass":"Service", "MessageType":"Response", "POIID":"V400m-346403161", "ProtocolVersion":"3.0", "SaleID":"POSSystemID12345", "ServiceID":"833" } } }
enable service request (see the next step). -
-
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
Writing data to MIFARE DESFire is currently supported only on Android terminals.
-
Create an
OperationJSON object and specify:Structure of Operation object for write data request - Mifare DESFireParameter Required Description Type
NFCWrite: writes data to the specified sector. Variant
MifareDesfire: the type of NFC tag. NFCData
If you leave the NFCDataarray empty when trying to write, the response will return theUIDand thevariantbut will not write to the card.An array with:aid: the application ID that contains thefileIdsto write to.keyId: the ID of the key used to access the specifiedaid.fileIds: the files inside theaidto write to.fileOffsets: the byte in the specified file from which to start writing data.fileLengths: the number of bytes to write to, starting from the byte specified infileOffset.data: data to write to the specified file.ExpectedUid
Specifies the UIDof the NFC tag to which you want to write the data. If theUIDof the presented NFC tag is different from theExpectedUid, the request fails andWRONG_CARDis returned in theAdditionalResponse. If passed without a value, the parameter is ignored.{ "Operation":[ { "Type":"NFCWrite", "Variant":"MifareDesfire", "NFCData":[ { "aid":"376632", "keyId":0, "fileIds":[0], "fileOffsets":[0], "fileLengths":[16], "data":"0AA0000000000AA0" }, { "aid":"376632", "keyId":0, "fileIds":[1], "fileOffsets":[0], "fileLengths":[16], "data":"0AA0000000000AA1" } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringICAgewogICAgICAgIk9wZXJhdGlvbiI6WwogICAgICAgICAgIHsKICAgICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlRGVzZmlyZSIsCiAgICAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgImFpZCI6IjM3NjYzMiIsCiAgICAgICAgICAgICAgICAgICAgICAgImtleUlkIjowLAogICAgICAgICAgICAgICAgICAgICAgICJmaWxlSWRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVPZmZzZXRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVMZW5ndGhzIjpbMTZdLAogICAgICAgICAgICAgICAgICAgICAgICJkYXRhIjoiMEFBMDAwMDAwMDAwMEFBMCIKICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgImFpZCI6IjM3NjYzMiIsCiAgICAgICAgICAgICAgICAgICAgICAgImtleUlkIjowLAogICAgICAgICAgICAgICAgICAgICAgICJmaWxlSWRzIjpbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVPZmZzZXRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVMZW5ndGhzIjpbMTZdLAogICAgICAgICAgICAgICAgICAgICAgICJkYXRhIjoiMEFBMDAwMDAwMDAwMEFBMSIKICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgXQogICAgICAgICAgIH0KICAgICAgIF0KICAgfQ== -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when writing to the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
fileIds0 and 1 ofaid376632 on a MifareDesfire NFC tag: Write data request - MIFARE DESFire{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"283", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer", "SaleToPOIData":"ICAgewogICAgICAgIk9wZXJhdGlvbiI6WwogICAgICAgICAgIHsKICAgICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlRGVzZmlyZSIsCiAgICAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgImFpZCI6IjM3NjYzMiIsCiAgICAgICAgICAgICAgICAgICAgICAgImtleUlkIjowLAogICAgICAgICAgICAgICAgICAgICAgICJmaWxlSWRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVPZmZzZXRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVMZW5ndGhzIjpbMTZdLAogICAgICAgICAgICAgICAgICAgICAgICJkYXRhIjoiMEFBMDAwMDAwMDAwMEFBMCIKICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgICAgImFpZCI6IjM3NjYzMiIsCiAgICAgICAgICAgICAgICAgICAgICAgImtleUlkIjowLAogICAgICAgICAgICAgICAgICAgICAgICJmaWxlSWRzIjpbMV0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVPZmZzZXRzIjpbMF0sCiAgICAgICAgICAgICAgICAgICAgICAgImZpbGVMZW5ndGhzIjpbMTZdLAogICAgICAgICAgICAgICAgICAgICAgICJkYXRhIjoiMEFBMDAwMDAwMDAwMEFBMSIKICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgXQogICAgICAgICAgIH0KICAgICAgIF0KICAgfQ==" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof the CardAcquisitionResponse note:-
NFC.data: the data from the specifiedaid.- For a single
aid, the data shows as NFC.data.376632.F0=0AA0000000000AA0. - For multiple
aidfields andfileIds, the data from eachaidshows as value of theNFC.datafor thataidandfileIds: NFC.data.376632.F0=0AA0000000000AA0&…&NFC.data.376632.F1=0AA0000000000AA1.
- For a single
-
NFC.status: the status of the write action for everyaid, for example NFC.status=376632.OK. -
NFC.uid: the unique identifier of the NFC tag. -
NFC.variant: the type of the NFC tag, in this case MIFARE DESFire.
After you write to the specified sectors on the NFC tag, the loading screen continues to show until you send an{ "SaleToPOIResponse":{ "CardAcquisitionResponse":{ "POIData":{ "POIReconciliationID":"1000", "POITransactionID":{ "TimeStamp":"2022-10-18T08:17:51.000Z", "TransactionID":"i495001668683154001" } }, "PaymentInstrumentData":{ "CardData":{ }, "PaymentInstrumentType":"Card" }, "Response":{ "AdditionalResponse":"tid=10502371&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&NFC.data.376632.F0=0AA0000000000AA0&store=BookStore&NFC.data.376632.F1=0AA0000000000AA1&iso8601TxDate=2022-11-17T11%3a05%3a54.879Z&posOriginalAmountValue=0&txtime=12%3a05%3a54&NFC.uid=041842F2325780&txdate=17-11-2022&merchantReference=1&posadditionalamounts.originalAmountCurrency=EUR&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&posAmountCashbackValue=0&NFC.variant=mf_desfire&posEntryMode=CLESS_SWIPE&NFC.status=376632.OK&posAuthAmountValue=0", "Result":"Success" }, "SaleData":{ "SaleTransactionID":{ "TimeStamp":"2022-10-03T10:56:42.966Z", "TransactionID":"889" } } }, "MessageHeader":{ "MessageCategory":"CardAcquisition", "MessageClass":"Service", "MessageType":"Response", "POIID":"S1EL-000150183300032", "ProtocolVersion":"3.0", "SaleID":"POSSystemID12345", "ServiceID":"833" } } }
enable service request (see the next step). -
-
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
MIFARE Ultralight is an NFC tag with lower security standards so it does not have sectors and keys. The data is instead segmented into pages, and you do not need to specify keys to write.Engage terminals can only read/write to unlocked MIFARE Ultralight C pages.Regular card acquisitions are not affected by this feature and show the Adyen UI as expected.
-
Create an
OperationJSON object and specify:Structure of Operation object for write data request - Mifare UltralightParameter Required Description Type
NFCWrite: writes data to the specified page. Variant
The type of NFC tag used: MifareUltralight, MifareUltralightC, or MifareUltralightAES. NFCData
If you leave the NFCDataarray empty when trying to write, the response will return theUIDand thevariantbut will not write to the card.An array with:pageOffset: specifies what page to write data to on MIFARE Ultralight or MIFARE Ultralight C.data: data to write to the specified page.ultralightCKey: required only for the Ultralight C variant. HEX-encoded key used to authenticate the card. If you do not provide a key, the default one is used:49454D4B41455242214E4143554F5946.ultralightAESKey: required only for the Ultralight AES variant. HEX-encoded key used to authenticate the card. If you do not provide a key, the default one is used:00000000000000000000000000000000.ultralightAESKeyId: optional for the Ultralight AES variant. The key that specifies what part of the card’s memory to access. Possible values: 0: (default)DataProtKeyauthenticates the card and accesses protected user memory and theUID. 1:UIDRetrKeyauthenticates the card and retrieves theUIDand theECDSAsignature.ExpectedUid
Specifies the UIDof the NFC tag to which you want to write the data. If theUIDof the presented NFC tag is different from theExpectedUid, the request fails andWRONG_CARDis returned in theAdditionalResponse. If passed without a value, the parameter is ignored.{ "Operation":[ { "Type":"NFCWrite", "Variant":"MifareUltralight", "NFCData":[ { "pageOffset":4, "data":"BFBFBFBF" } ] } ] } -
Encode the
OperationJSON object to Base64. You will pass the resulting string inSaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlVWx0cmFsaWdodCIsCiAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgInBhZ2VPZmZzZXQiOjQsCiAgICAgICAgICAgICAgICAgICAgImRhdGEiOiJCRkJGQkZCRiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ== -
Make a card acquisition request, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to CardAcquisition. -
The CardAcquisitionRequest.SaleData object with:
Parameter Required Description SaleTransactionID
An object with: TransactionID: your reference to identify the transaction. We recommend using a unique value.TimeStamp: date and time of the request in UTC format.SaleToPOIDataThe Base64-encoded OperationJSON object.
The CardAcquisitionRequest.CardAcquisitionTransaction object with:Parameter Required Description TotalAmountThe transaction amount. You can omit the TotalAmountfield when writing to the NFC tag.If you omitTotalAmount, you still have to include an emptyCardAcquisitionTransactionfield in the request.
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"283", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer", "SaleToPOIData":"ewogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlVWx0cmFsaWdodCIsCiAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgInBhZ2VPZmZzZXQiOjQsCiAgICAgICAgICAgICAgICAgICAgImRhdGEiOiJCRkJGQkZCRiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ==" }, "CardAcquisitionTransaction":{ } } } } -
The standard
-
When the card acquisition succeeds, in the
AdditionalResponseof the CardAcquisitionResponse note:NFC.data: The data from the specified page, such as NFC.data.P05=0F2AF6C4….NFC.status: The status of the write action for everypage, for example NFC.status=P04.OK.NFC.uid: The unique identifier of the NFC tag.NFC.variant: The type of the NFC tag, in this case MIFARE Ultralight.
After you write to the specified pages on the NFC tag, the loading screen continues to show until you send an{ "SaleToPOIResponse": { "CardAcquisitionResponse": { "POIData": { "POIReconciliationID": "1000", "POITransactionID": { "TimeStamp": "2022-10-18T13:22:07.000Z", "TransactionID": "CglQ001666099327010" } }, "PaymentInstrumentData": { "CardData": {}, "PaymentInstrumentType": "Card" }, "Response": { "AdditionalResponse": "tid=47353332&transactionType=GOODS_SERVICES&giftcardIndicator=false&posAmountGratuityValue=0&store=BookStore&iso8601TxDate=2022-10-18T13%3a22%3a07.324Z&posOriginalAmountValue=0&txtime=15%3a22%3a07&NFC.uid=04DDECD2FA7280&txdate=18-10-2022&merchantReference=247&posadditionalamounts.originalAmountCurrency=EUR&posAuthAmountCurrency=EUR&message=CARD_ACQ_COMPLETED&posAmountCashbackValue=0&NFC.data.P04=BFBFBFBF&NFC.variant=mf_ultralight_ev1&posEntryMode=CLESS_SWIPE&NFC.status=P04OK&posAuthAmountValue=0", "Result": "Success" }, "SaleData": { "SaleTransactionID": { "TimeStamp": "2022-10-03T10:56:42.966Z", "TransactionID": "247" } } }, "MessageHeader": { "MessageCategory": "CardAcquisition", "MessageClass": "Service", "MessageType": "Response", "POIID": "V400m-347353332", "ProtocolVersion": "3.0", "SaleID": "POSSystemID12345", "ServiceID": "236" } } }
enable service request (see the next step). -
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).Omit if you have an NFC configuration that hides the Adyen UI while using a dedicated Android app for NFC operations. Otherwise the Adyen UI will be brought to the foreground.
DisplayOutputobject, to stop the card acquisition flow. The terminal will show Canceled, a red cross
, and Transaction canceled.
Basic request to cancel the card acquisition data
{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
Create a session
If your use case requires multiple read/write actions on an NFC tag, you can create a session to make multiple requests part of the same user interaction. While the session is in progress, the terminal shows the One moment loading screen.The flow consists of the following steps:-
In the first card acquisition request to identify, read, or write NFC tags, you start the session by adding
Session.Type: Begin in theSaleToPOIData. All requests that belong to the session must contain the sameSession.Idin theSaleToPOIData. - You then send more card acquisition requests for subsequent NFC tag operations.
-
To finish the session:
- In the last NFC tag card acquisition request of the session, you add
Session.Type: End in theSaleToPOIData. - You send an enable service request to ensure the terminal stops showing the loading screen.
- In the last NFC tag card acquisition request of the session, you add
- Start a session and identify the NFC tag type
- Continue the session with a Read data request
- Finish the session with a Write data request.
1. Start a session and identify the NFC tag type
When starting the session, you need specify theId to connect the requests into a single session. Here’s example of how identify the tag and start the session:-
Create a JSON object with:
JSON object
Parameter Required Description Session.Type
Begin: starts the session. Session.Id
Your unique reference of the session. Session.Timeout
How long the One moment screen is shown on the terminal display, in milliseconds. If there is no end session request, how long before the session data is deleted and new requests can be sent. Operation.Type
NFCReadUID: returns the NFC tag identifier and type. { "Session": { "Type": "Begin", "Id": "50", "TimeoutMs": "60000" }, "Operation":[ { "Type":"NFCReadUID" } ] } -
Encode the JSON object to Base64. You will pass the resulting string in
SaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIlNlc3Npb24iOnsKICAgICAgICAiVHlwZSI6IkJlZ2luIiwKICAgICAgICAiSWQiOiI1MCIsCiAgICAgICAgIlRpbWVvdXRNcyI6IjYwMDAwIgogICAgfSwKICAgICJPcGVyYXRpb24iOlsKICAgICAgICB7CiAgICAgICAgICAgICJUeXBlIjoiTkZDUmVhZFVJRCIKICAgICAgICB9CiAgICBdCn0= -
Make a card acquisition request with the Base64-encoded string in the
SaleToPOIData. Start a session and identify the NFC tag type{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"1020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"02072", "TimeStamp":"2020-01-07T14:14:04+00:00" }, "SaleToPOIData":"ewogICAgIlNlc3Npb24iOnsKICAgICAgICAiVHlwZSI6IkJlZ2luIiwKICAgICAgICAiSWQiOiI1MCIsCiAgICAgICAgIlRpbWVvdXRNcyI6IjYwMDAwIgogICAgfSwKICAgICJPcGVyYXRpb24iOlsKICAgICAgICB7CiAgICAgICAgICAgICJUeXBlIjoiTkZDUmVhZFVJRCIKICAgICAgICB9CiAgICBdCn0=" }, "CardAcquisitionTransaction":{ } } } }
2. Send read data request with Session.Id
Make sure to include theSession.Id specified in the SaleToPOIData of the first request. Here’s example of how to read data from MIFARE Classic as part of the session:-
Create a JSON object with:
On Castles Android terminalsYou cannot use
Parameter Required Description Session.Id
Your unique reference of the session, specified in the first request. Operation.Type
NFCRead: reads data from the specified sector. Operation.Variant
MifareClassic: the type of NFC tag. Operation.NFCData
If you leave the NFCDataarray empty, the terminal will try to read all sectors.An array with:sector: specifies what sector on MifareClassic to read from.keyType: specifies what key is used to access a sector, a (default) or b.keyType: b due to a limitation from Castles. | JSON object{ "Session":{ "Id":"50" }, "Operation":[ { "Type":"NFCRead", "Variant":"MifareClassic", "NFCData":[ { "sector":1, "keyType":"a" } ] } ] } -
Encode the JSON object to Base64. You will pass the resulting string in
SaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIlNlc3Npb24iOnsKICAgICAgICAiSWQiOiI1MCIKICAgIH0sCiAgICAiT3BlcmF0aW9uIjpbCiAgICAgICAgewogICAgICAgICAgICAiVHlwZSI6Ik5GQ1JlYWQiLAogICAgICAgICAgICAiVmFyaWFudCI6Ik1pZmFyZUNsYXNzaWMiLAogICAgICAgICAgICAiTkZDRGF0YSI6WwogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJzZWN0b3IiOjEsCiAgICAgICAgICAgICAgICAgICAgImtleVR5cGUiOiJhIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXQp9 -
Make a card acquisition request with the Base64-encoded string in the
SaleToPOIData.
The following example shows how to read data from MifareClassic NFC tag as part of the session: Read data request with Sessions.Id{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"282", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer" }, "SaleToPOIData":"ewogICAgIlNlc3Npb24iOnsKICAgICAgICAiSWQiOiI1MCIKICAgIH0sCiAgICAiT3BlcmF0aW9uIjpbCiAgICAgICAgewogICAgICAgICAgICAiVHlwZSI6Ik5GQ1JlYWQiLAogICAgICAgICAgICAiVmFyaWFudCI6Ik1pZmFyZUNsYXNzaWMiLAogICAgICAgICAgICAiTkZDRGF0YSI6WwogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICJzZWN0b3IiOjEsCiAgICAgICAgICAgICAgICAgICAgImtleVR5cGUiOiJhIgogICAgICAgICAgICAgICAgfQogICAgICAgICAgICBdCiAgICAgICAgfQogICAgXQp9", "CardAcquisitionTransaction":{ } } } }
3. Write data to the NFC tag and end the session
In the final request of the interaction, make sure to include the sameSession.Id and Session.Type: End. Here’s example of how to write data to MIFARE Classic and end the session:-
Create a JSON object with:
On Castles Android terminals you cannot use
Parameter Required Description Session.Type
End: ends the session. Session.Id
Your unique reference of the session. Operation.Type
NFCWrite: reads data from the specified sector. Operation.Variant
MifareClassic: the type of NFC tag. Operation.NFCData
If you leave the NFCDataarray empty when trying to write, the response will return theUIDand thevariantbut will not write to the card.An array with:sector: specifies what sector on MifareClassic to read from.keyType: specifies what key is used to access a sector, a (default) or b.keyType: b due to a limitation from Castles. | JSON object{ "Session":{ "Type": "End", "Id":"50" }, "Operation":[ { "Type": "NFCWrite", "Variant": "MifareClassic", "NFCData":[ { "sector": 1, "data":"..." } ] } ] } -
Encode the JSON object to Base64. You will pass the resulting string in
SaleData.SaleToPOIData. Converted to a Base64-encoded stringewogICAgIlNlc3Npb24iOnsKICAgICAgICAiVHlwZSI6IkVuZCIsCiAgICAgICAgIklkIjoiNTAiCiAgICB9LAogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlQ2xhc3NpYyIsCiAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgInNlY3RvciI6MSwKICAgICAgICAgICAgICAgICAgICAiZGF0YSI6Ii4uLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ== -
Make a card acquisition request with the Base64-encoded string in the
SaleToPOIData.
The following example shows how to write data MifareClassic NFC tag and end the session: Write data to the NFC tag and end the sessionAfter you end the session, the loading screen continues to show until you send an enable service request (see the{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"CardAcquisition", "MessageType":"Request", "ServiceID":"283", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "CardAcquisitionRequest":{ "SaleData":{ "SaleTransactionID":{ "TransactionID":"369", "TimeStamp":"2021-03-05T12:22:57.449Z" }, "TokenRequestedType":"Customer" }, "SaleToPOIData":"ewogICAgIlNlc3Npb24iOnsKICAgICAgICAiVHlwZSI6IkVuZCIsCiAgICAgICAgIklkIjoiNTAiCiAgICB9LAogICAgIk9wZXJhdGlvbiI6WwogICAgICAgIHsKICAgICAgICAgICAgIlR5cGUiOiJORkNXcml0ZSIsCiAgICAgICAgICAgICJWYXJpYW50IjoiTWlmYXJlQ2xhc3NpYyIsCiAgICAgICAgICAgICJORkNEYXRhIjpbCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgInNlY3RvciI6MSwKICAgICAgICAgICAgICAgICAgICAiZGF0YSI6Ii4uLiIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgXQogICAgICAgIH0KICAgIF0KfQ==", "CardAcquisitionTransaction":{ } } } }
next step). -
To stop the loading screen, make an enable service request to a Terminal API endpoint, specifying:
-
The standard
SaleToPOIRequest.MessageHeaderobject, withMessageClassset to Service andMessageCategoryset to EnableService. -
EnableServiceRequest with:
Parameter Required Description TransactionAction
AbortTransaction. DisplayOutputOptional object to show your own message and an ‘Approved’ icon (green check mark) or a ‘Declined’ icon (red cross).If you omit DisplayOutput, the terminal shows Canceled, a red cross
, and Transaction canceled. Omit if you have a NFC configuration that hides the Adyen UI to make sure the UI does not show.
DisplayOutputobject, to stop the card acquisition flow. Basic request to cancel the card acquisition data{ "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"EnableService", "MessageType":"Request", "ServiceID":"3020711110", "SaleID":"POSSystemID12345", "POIID":"V400m-346403161" }, "EnableServiceRequest":{ "TransactionAction":"AbortTransaction" } } } -
The standard
Hide the Adyen UI during NFC operations
Optionally, if you want to use a dedicated Android app to process NFC operations for stored value cards or for identity cards, you can show your own UI on the terminal display instead of the Adyen UI. This can be useful, for example, for a loyalty card or transport card.If you want to use this feature, contact our Support Team.When this feature is enabled and you make a card acquisition request to identify, read, or write to an NFC tag:- If the payment terminal detects a stored value or identity card, the Adyen UI is hidden.
- If the terminal detects a regular payment card during any of the NFC card acquisition flows, the response returns a BLOCK_CARD error. This does not mean that the card itself is blocked, but that it cannot be used for operations with your Android app. We recommend that your system returns a message that instructs the terminal operator to ask the shopper to present a card or tag that can be used with your app.
{
"SaleToPOIResponse":{
"CardAcquisitionResponse":{
"POIData":{
"POIReconciliationID": "1000",
"POITransactionID":{
"TimeStamp": "2022-10-10T12:50:31.000Z",
"TransactionID": "CglQ001665406231000"
}
},
"PaymentInstrumentData":{
"CardData": {},
"PaymentInstrumentType": "Card"
},
"Response":{
"AdditionalResponse": "...refusalReason=199%20Card%20blocked&message=BLOCK_CARD...",
"ErrorCondition": "Refusal",
"Result": "Failure"
},
"SaleData":{
"SaleTransactionID":{
"TimeStamp": "2022-10-03T10:56:42.198Z",
"TransactionID": "729"
}
}
},
"MessageHeader": {...}
}
}
Supported terminals and NFC tags
The following table shows the payment terminal models that support NFC tags.Castles Android
| Models | MIFARE Classic | MIFARE DESFire | MIFARE Ultralight | MIFARE Ultralight C | MIFARE Ultralight AES |
|---|---|---|---|---|---|
| AMS1 | ![]() | ![]() | ![]() | ![]() | ![]() |
| S1E | ![]() | ![]() | ![]() | ![]() | ![]() |
| S1E2L | ![]() | ![]() | ![]() | ![]() | ![]() |
| S1F2 | ![]() | ![]() | ![]() | ![]() | ![]() |
| S1F2L | ![]() | ![]() | ![]() | ![]() | ![]() |
| S1U2 | ![]() | ![]() | ![]() | ![]() | ![]() |
Verifone Android
| Models | MIFARE Classic | MIFARE DESFire | MIFARE Ultralight | MIFARE Ultralight C | MIFARE Ultralight AES |
|---|---|---|---|---|---|
| M450 | ![]() | ![]() | ![]() | ![]() | ![]() |
| P630 | ![]() | ![]() | ![]() | ![]() | ![]() |
Engage
Engage terminals cannot authenticate MIFARE Ultralight C tags. This means that reading/writing Ultralight C tags only works on unlocked pages.| Models | MIFARE Classic | MIFARE DESFire | MIFARE Ultralight | MIFARE Ultralight C | MIFARE Ultralight AES |
|---|---|---|---|---|---|
| e285p | ![]() | ![]() | ![]() | ![]() | ![]() |
| M400 | ![]() | ![]() | ![]() | ![]() | ![]() |
| P400 Plus | ![]() | ![]() | ![]() | ![]() | ![]() |
| V240m Plus | ![]() | ![]() | ![]() | ![]() | ![]() |
| V400c Plus | ![]() | ![]() | ![]() | ![]() | ![]() |
| V400m | ![]() | ![]() | ![]() | ![]() | ![]() |
| UX300 | ![]() | ![]() | ![]() | ![]() | ![]() |
| UX410 | ![]() | ![]() | ![]() | ![]() | ![]() |
Datecs
| Models | MIFARE Classic | MIFARE DESFire | MIFARE Ultralight | MIFARE Ultralight C | MIFARE Ultralight AES |
|---|---|---|---|---|---|
| SFO1 | ![]() | ![]() | ![]() | ![]() | ![]() |