The NFC Tag service is designed to pass tag data to the payment terminal for processing.
NFC Tag presents its own terminal UI. If a previous Display is still shown, abort that Display and wait for the Abort to complete before starting NFC Tag. See Device Display & Interaction for details.
Global reference of the sale transaction for the sale system.
Message content.
Maximum time to wait for the transmission to complete.
Unit: second, the default value is 60.
The number of times an NFC tag needs to be read.
The default value is 1.
Unique identification of the partner that is the recipient of the message exchange.
For example, the POS SN
Result of the requested transaction.
Detail of the response.
Additional information to be logged for further examination.
When you receive the terminal result through the SDK callback interface and NFCTagResult.response = SUCC, you can obtain additional message.
How many times the NFC tag has been read.
NFCTagParam nfcTagParam = NFCTagParam.newBuilder()
.messageContent("https://www.apple.com/")
.maximumWaitingTime(30)
.transactionReference(String.valueOf(System.currentTimeMillis()))
.detectCount(1)
.build();
RetailerManager.provideDeviceService().newNFCTagExchange(nfcTagParam).startAsyncExchange(new Exchange.RetailerSDKCallback<NFCTagResult>() {
@Override
public void onError(int code, String msg) {
Logger.e(TAG,"NfcTagResult failed: " + code + ", " + msg);
}
@Override
public void onResult(NFCTagResult result) {
Logger.i(TAG,"NfcTagResult result: " + GsonUtils.toJson(result));
}
});using System;
using PayExplorerConnect;
public void HandleNFCTagResult(NFCTagResult result)
{
Console.WriteLine($"Response: {result.Response}");
}
public void HandleNFCTagError(int code, string message)
{
Console.WriteLine($"Error: {code}, Message: {message}");
}
public string StartNFCTag()
{
// Set the NFC content, timeout, and detection count for your scenario.
NFCTagParam param = new NFCTagParam.Builder()
.MessageContent("https://www.apple.com/")
.MaximumWaitingTime(30)
.DetectCount(1)
.Build();
string exchangeId = RetailerManager
.ProvideDeviceService()
.NewNFCTagExchange(param)
.StartAsyncExchange(HandleNFCTagResult, HandleNFCTagError);
return exchangeId;
}#import <PayExplorerConnect/RetailerManager.h>
#import <PayExplorerConnect/NFCTagParam+Builder.h>
NFCTagParam *params = [NFCTagParam makeWithBuilder:^(NFCTagParamBuilder *builder) {
builder.transactionReference(@"00000008");
builder.messageContent(@"https://www.apple.com/");
builder.maximumWaitingTime(30);
builder.detectCount(1);
}];
[[RetailerManager sharedManager] nfcTag:params block:^(NSString *exchangeId) {
// Save the exchange ID to track this request.
} result:^(id result, NSInteger errcode, NSString *msg) {
if (errcode != 0 && result == nil) {
// Handle request error.
return;
}
NFCTagResult *nfcResult = (NFCTagResult *)result;
// Handle NFC tag result.
}];