Blog

    NFC Payment System for Mobile Apps: Tap-to-Pay with a Device Token

    By GauravDecember 2, 20267 mins read
    On this page

    An NFC payment system for mobile apps lets a phone pay at a terminal with a tap, and the phone should never send the card number. A payment token, limited to that device or use, stands in for it. On Android, the token answers the terminal from a secure element chip or from the app through host card emulation.

    Fintech founders and wallet product teams will find the tap sequence, token provisioning, Android settings that break taps, on-device storage and testing.

    How does an NFC payment system for mobile apps work?

    An NFC payment system for mobile apps has the phone emulate a contactless card that presents a payment token instead of the card number, answered from a secure element or by the app through host card emulation. Agnotic Technologies builds the app side and connects it to the token service your card issuer or processor provides.

    Adding tap-to-pay to an app?

    We build the wallet app, the token flow and the NFC service, with your issuer or processor.

    Android supports card emulation through a secure element, where the NFC controller routes reader data to that chip, and from Android 4.4 through host-based card emulation, where an app's service answers the reader directly.

    EMV Payment Tokenisation replaces the primary account number with an EMV Payment Token whose use is limited, for example to a specific merchant, device or payment scenario.

    Should the app use host card emulation or a secure element?

    Whether the app uses host card emulation or a secure element depends on the device, the issuer's program and the network rules. Agnotic confirms which one the issuer supports before building.

    Secure element versus host card emulation on Android
    Secure elementHost card emulation
    Who answers the terminalA chip in the deviceA service in the app
    App's role during the tapNone. It can check status afterHandles the reader's commands
    Where the token livesIn the chipManaged by the app and the token service
    Available onDevices with a provisioned secure elementAndroid 4.4 and higher

    Only one AID group in Android's payment category can be enabled at a time. On Android 15 and higher, the user picks a default wallet app, and HCE services that declare a payment-category AID group count as wallet apps.

    What must the app never do?

    The app must never store or send the card number, and it must not assume it is the default wallet. Agnotic checks the wallet role and asks the user when it is not.

    • Store only tokens and token references, never the card number.
    • Check whether the app holds the default wallet role on Android 15 and higher, and request it if not.
    • Register payment AIDs only in the payment category, and closed-loop cards in the other category.
    • Check Apple's own developer terms before planning NFC payments on iPhone.

    What happens between the terminal and the phone during a tap?

    During a tap, the terminal sends a series of commands over NFC, starting with a selection of the payment application, and the phone's card emulator answers each one with token data. The NFC controller decides whether the app's HCE service or a secure element answers.

    NFC tap-to-pay from an Android phone: the payment terminal sends SELECT AID, the NFC controller routes it by AID to the app's HCE service or to a secure element, the card emulator answers with the payment token instead of the card number, and the terminal sends the transaction through the acquirer and payment networks to the card issuer for authorisation
    • Step 1, the terminal polls and the phone's NFC controller answers as a contactless card.
    • Step 2, the terminal sends SELECT AID for the payment application it supports.
    • Step 3, the controller routes that command, and the ones after it, to the HCE service or the secure element registered for the AID.
    • Step 4, the emulator answers with the token and the data the network specification requires, never the card number.

    How does the token get onto the phone in the first place?

    The token gets onto the phone when the user adds a card in the app and the issuer's token service creates a token for that device after the issuer approves the request. The app receives a token and a reference to it, not the card number to keep.

    • The user enters or scans the card in the app, and the app sends it straight to the token service over a secure channel.
    • The issuer decides whether to approve, and may ask the user to verify with a code or the issuer's own app.
    • The token service returns the token for this device, which the app or secure element stores.
    • The card number is not kept on the phone or on the app's servers after the request.

    The exact steps, and whether the app's own servers see the card number at all, depend on the token service your issuer or processor uses. Agnotic designs around that service's rules.

    Android settings that change whether a tap works

    Whether a tap works depends on the screen state, the lock state and the Secure NFC setting, as well as on which app holds the default wallet role. These settings explain most taps that fail in testing but work on the developer's own phone.

    On Android 10 and higher, while Secure NFC is on, all card emulators are unavailable with the screen off, and HCE services cannot work from the lock screen whatever the requireDeviceUnlock setting says.

    Settings that affect an HCE tap
    SettingWho controls itWhat to check
    Lock screen requirementThe app, through requireDeviceUnlock in its HCE service declarationWhether the phone must be past the lock screen before paying
    Secure NFCThe user, in device settingsWhether taps work with the screen off or locked
    Default walletThe user, on Android 15 and higherWhether your app answers payment taps at all
    NFC on or offThe userShow a prompt in the app when NFC is off

    What should the app do when it is not the default wallet?

    When the app is not the default wallet, it should say so plainly on the pay screen and offer to send the user to the setting, rather than letting a tap go to another app. Only one payment app answers a payment tap at a time.

    • Check the wallet role when the pay screen opens, not only at install.
    • Explain in one line why the setting matters before sending the user there.
    • Recheck after the user returns, since they may have picked another app.
    • Test what happens when a second wallet app is installed after yours.

    What does the app store, and where?

    The app stores a token reference, the display details the user needs to recognize the card, and the keys or credentials the token service issues for this device, each in the platform's protected storage. The card number is never one of them.

    What lives on the phone
    ItemWhere it livesNotes
    Token referenceApp storage, protected by the app sandboxUsed to show and manage the card
    Payment credentials for tapsSecure element, or Keystore-backed storage for HCEAs the token service specifies
    Card art and last digitsApp storageSupplied by the token service for display
    Card numberNowhere on the phoneOnly the issuer and token service hold it

    What happens after the tap, from the terminal to the issuer?

    After the tap, the terminal sends the transaction with the token to its acquirer, the acquirer passes it across the payment network, and the issuer approves or declines it. The phone is out of the loop by then; the app learns the result from the issuer's or processor's own notification.

    The app should therefore not show a final approved message based only on the NFC exchange. It can show that the tap was sent, then update when the notification arrives, and show a clear decline reason when one comes back.

    What happens when a phone is lost or replaced?

    When a phone is lost or replaced, the token on that device is suspended or deleted through the token service, and the new phone gets its own token. The card itself usually keeps working, because only the device's token was exposed.

    • Give the user a way to suspend a lost device from another device or by calling the issuer.
    • On a new phone, add the card again so the token service issues a new device token.
    • Remove token references and credentials from the app when the user signs out or deletes the card.

    Who owns which part of a tap-to-pay build?

    A tap-to-pay build spans the issuer or processor, the token service, the card network's rules and the app team. Each owns a separate decision, and the app team cannot make the others' choices for them.

    • Issuer or processor: which cards can be added, how users are verified and what testing and approval the network requires.
    • Token service: issuing, suspending and replacing tokens, and what the device must store.
    • App team: the wallet app, the HCE service, the wallet role checks and the user's screens.
    • Security review: storage, logging and what happens on a lost or rooted device.

    How do you test NFC payments before launch?

    Test NFC payments on real devices against test terminals the issuer or processor provides, across Android versions and with each setting that changes tap behavior. Emulators cannot stand in for the NFC controller.

    • Tap with the screen on, off and locked, with Secure NFC on and off.
    • Tap with your app as default wallet, then with another wallet set as default.
    • Suspend the token and confirm the next tap is declined and the app shows why.
    • Check logs to confirm no token data or command payloads are written in plain text.

    What are the common mistakes with NFC payment systems in mobile apps?

    The common mistakes with NFC payment systems in mobile apps tend to pass every test on the developer's own phone and fail only in customers' hands.

    • Keeping the card number on the device or the app's servers for display, when the token service supplies card art and last digits.
    • Assuming the app is the default wallet and never checking the role on the pay screen.
    • Showing an approved message as soon as the NFC exchange ends, before the issuer has answered.
    • Writing command payloads or token data to debug logs during development and shipping them.
    • Testing on one phone with one Android version and default NFC settings.

    What does tap-to-pay mean for your build plan?

    Tap-to-pay depends on decisions made outside the app team, so the build plan starts with the issuer or processor rather than with screens. The app cannot be finished until the token service and the card emulation route are confirmed.

    • Step 1, confirm the issuer or processor program, the token service and whether HCE or a secure element is supported.
    • Step 2, list target devices and Android versions, and decide how the app handles the default wallet role.
    • Step 3, build card adding, the HCE service or secure element integration, and lost-device handling.
    • Step 4, test on real terminals with every setting that changes tap behavior, then complete the testing and approval steps the issuer or network requires.

    How does Agnotic build tap-to-pay into a mobile app?

    Agnotic builds tap-to-pay by writing the wallet app, the HCE service or secure element integration and the token flow against the token service your issuer or processor provides. The card number never reaches the phone's storage.

    We confirm the issuer's program, target devices and network requirements first, then test on real terminals with every setting that changes how a tap behaves.

    Token, not card number

    The phone presents a token. The app never holds the card number.

    Related reading on Agnotic

    Digital wallets, fintech software, online checkout in Android and more industry build notes.

    Sources

    Frequently Asked Questions

    Banks, card issuers, fintechs and closed-loop programs that want customers to pay at terminals from their own app instead of a third-party wallet. They need an issuer or processor with a token service behind the app.

    Talk to an engineer about your project

    Tell us your issuer or processor and target devices. We will confirm the token flow and whether HCE or a secure element fits.