Skip to content
EMV Tools

EMV in 5 minutes

A short tour for developers who have never worked with chip payments. It explains each acronym the first time it appears, and every one has an entry in the glossary.

Open the glossary

What EMV is

EMV is the global standard for chip payment cards and the devices that read them. The name comes from Europay, Mastercard, and Visa, the companies that started it; today EMVCo maintains it.

A magnetic stripe is only read. A chip is a small computer: it answers commands, keeps counters, and signs each transaction with a secret key, so a copied card or a replayed transaction is easy to spot.

Contactless payments with a card or a phone follow the same ideas over a short radio link, with fewer steps so the tap stays fast.

Card, terminal, and issuer

The card, whose chip is also called the integrated circuit card (ICC), holds the account data and the keys of the bank that issued it.

The terminal is the payment device at the shop, also called the point of sale (POS). It talks to the card, applies its own rules, and decides whether to approve offline, decline, or ask the issuer.

The issuer is the bank that gave the card to the cardholder. It checks the card’s cryptogram online and approves or declines. Between the terminal and the issuer sit the acquirer (the merchant’s bank) and the card network, which carry the authorization message.

Who takes part in a card payment

Who takes part in a card paymentThe card talks to the terminal through APDU commands. For an online authorization, the terminal sends a request through the acquirer and the card network to the issuer, and the response comes back the same way.APDUCardTerminalAcquirerNetworkIssuerAuthorization requestResponse

Tags and TLV

Almost every piece of EMV data travels as a tag, a length, and a value (TLV). The tag is a short hex code that says what the data is, the length says how many bytes follow, and the value is the data itself.

EMV follows the BER-TLV rules, so a value can contain more tags. Those containers are called templates or constructed tags, and the TLV decoder shows them as a tree.

5F2ATag: what the data is
02Length: how many bytes follow
0978Value: the data itself
In 5F2A 02 0978, tag 5F2A is the transaction currency code, length 02 says two bytes follow, and the value 0978 is the numeric code of the euro.

Commands and responses

The terminal and the card talk in pairs of messages called application protocol data units (APDU). The terminal sends a command, such as the one that selects an application or the one that asks for a cryptogram (GENERATE AC).

The card answers with data, usually in TLV, followed by a two-byte status word (SW). The status word 9000 means the command worked; other values report a problem.

Most of the data the tools decode was read from these responses.

Anatomy of a command and its response

Anatomy of a command and its responseA command that selects the payment directory by its name: class 00, instruction A4, parameters 04 and 00, a data length of 0E (14 bytes), the directory name, and Le 00. The card answers with data that starts with template 6F, followed by the status word (SW) 90 00, which means success.Command: select by nameResponse00CLAA4INS04P100P20ELc2PAY.SYS.DDF01Data00Le6F …Data90SW100SW2
  • The first four bytes form the header: the class, the instruction, and two parameters. Instruction A4 selects an application or a file, and a first parameter of 04 selects it by name.
  • Lc gives the length of the data that follows. Le says how many bytes the terminal expects back; 00 means up to 256.
  • The last two bytes form the status word (SW). 90 00 means success; other values, such as 6A 82 (file not found), report a problem.

The main steps of a chip transaction

Every chip transaction follows roughly the same order. The links under each step open the tool or tag page for the data that step uses or produces.

  1. Application selection

    The terminal lists the payment applications on the card and picks one by its application identifier (AID).

  2. Initiate processing

    The terminal sends GET PROCESSING OPTIONS (GPO) with the data the card asked for in its processing options data object list (PDOL). The card answers with its application interchange profile (AIP), which says what it supports, and its application file locator (AFL), which says which records to read.

  3. Read application data

    The terminal reads the records listed in the AFL: the primary account number (PAN), the expiry date, the cardholder verification rules, and more.

  4. Offline data authentication

    The terminal checks that the card data is genuine with static, dynamic, or combined data authentication (SDA, DDA, or CDA), the methods of offline data authentication (ODA). It records the result in the terminal verification results (TVR) and the transaction status information (TSI).

  5. Processing restrictions

    The terminal checks that the card may be used here and now: application version, dates, and the application usage control (AUC), such as domestic or international and cash or goods.

  6. Cardholder verification

    The terminal walks the card’s list of cardholder verification methods (CVM) and uses the first rule it can apply, such as an online PIN, a signature, or no verification. The outcome is stored in the CVM Results.

  7. Terminal risk management

    The terminal compares the amount with its floor limit and may send some transactions online at random. Each finding sets a bit in the TVR.

  8. Terminal action analysis

    The terminal compares the TVR with the issuer action codes (IAC) from the card and its own terminal action codes (TAC) to choose: approve offline, go online, or decline.

  9. First GENERATE AC

    The terminal asks the card for an application cryptogram (AC). The cryptogram information data (CID) says which type it is: a transaction certificate (TC) approves offline, an authorization request cryptogram (ARQC) goes online, and an application authentication cryptogram (AAC) declines. The issuer application data (IAD) carries the card’s own view of the transaction.

  10. Online authorization

    With an ARQC, the terminal sends the chip data to the issuer inside an ISO 8583 message, in data element 55 (DE 55). The issuer checks the cryptogram and answers with an approval or a decline.

  11. Issuer authentication and completion

    The issuer’s answer can carry its own cryptogram (ARPC) in the issuer authentication data. The terminal passes it to the card, which closes the transaction with a second GENERATE AC: a TC to approve or an AAC to decline.

Online purchases: 3-D Secure

When you pay online there is no chip and no terminal, so the card cannot compute an application cryptogram. Instead, 3-D Secure (3DS) lets the issuer check the cardholder, for example with a code or a banking app, on its access control server (ACS).

When the check is done, the issuer returns a proof value: Visa calls it the cardholder authentication verification value (CAVV) and Mastercard the accountholder authentication value (AAV). The merchant sends it in the authorization together with the electronic commerce indicator (ECI), which says how the cardholder was authenticated.

Where the data comes from

The hex you paste into the tools usually comes from one of these places.

  • DE 55 in authorization messages

    Acquirer and issuer systems log ISO 8583 messages. Data element 55 holds the chip data as a list of TLV tags: paste it into the TLV decoder. The bitmap tool shows which data elements a message carries.

  • Card responses in terminal traces

    Terminal traces show each command and the card’s response. Paste a response without its two status bytes to read its tags. A data object list (DOL) tells you which data a later command will contain.

  • Logs and test tool exports

    Host logs, test tool exports, and certification reports print the same data as hex, text, decimal, or Base64. Convert it to hex first, then decode it.