Interactive walkthrough

An EMV card payment, step by step

Follow one chip-and-PIN purchase from the amount typed at the till to the money reaching the merchant. Every command to the chip, every key, cryptogram and message is computed in your browser with the same code as the tools on this site. Change a value or pick a scenario, and every step is recomputed. Pick a path to see what happens when the sale does not go as planned: the card declines after the issuer approved, the issuer does not answer, the card approves offline, the offline PIN fails, or the issuer sends a script to the card. For a tap instead of a chip insert, see the contactless walkthrough.

Calculations run in your browser; this page does not send the values you enter. Test keys only.

What this walkthrough models

Path
Online authorisation: the issuer approves or declines, and the chip checks its answer
Card and terminal
A contact chip card in an attended POS terminal that can go online
Card authentication
DDA (offline, with demo RSA keys), then the ARQC checked online by the issuer
Cardholder verification
Online PIN: ISO 9564 format 0 PIN block under one fixed terminal PIN key, checked by the issuer with a Visa PVV
Cryptogram version
Visa CVN 18: Option B card key, EMV common session key, ARPC method 2 with a Card Status Update, checked inside the second GENERATE AC (change it under "All values")
Messages
ISO 8583 (1987 field layout) in one common encoding: ASCII fields, a binary bitmap. Each network and host has its own dialect.
Issuer
Illustrative policies: fraud rules and scores, the counter rule, the CSU it sends, BIN routing and fee rates
4 digits
12 to 19 digits
Path
Try a scenario
All values: keys, card, issuer records, fees
The sale
grocery stores, supermarkets
The card
set when the card was issued; 4 digits
Keys (test keys only)
empty = derived from the IMK, as the issuer did
The issuer's records
Fees
CardBRL 25.50POS terminalAcquirerCard networkIssuer processorIssuer bankamount
1 The cashier enters the amountamount
1

The cashier enters the amount

POS terminal

The cashier types BRL 25.50 and the terminal turns it into the data elements every later step uses: the amount in minor units, the currency and country codes, today's date, the transaction type, and a fresh unpredictable number. The card puts that number into its cryptogram, so a cryptogram recorded from an earlier transaction does not fit this one. That protection depends on the number being unpredictable: a terminal whose numbers can be guessed lets an attacker collect cryptograms in advance (pre-play). The issuer adds its own checks on the card's counter and on duplicates.

9F02 Amount, authorised
000000002550BRL 25.50 in minor units
5F2A Currency
0986BRL
9A Transaction date
26113030 Nov 2026
9C Transaction type
00goods and services
9F37 Unpredictable number
5A3C91E7
2

The card is inserted: power and Answer To Reset

Card → POS terminal

The terminal powers the chip through its contacts and resets it. The chip answers with its Answer To Reset (ATR): a few bytes that tell the terminal how to talk to it. This card asks for the simplest setup EMV allows.

ATR
3B 60 00 00
Protocol
T=0character-based, the EMV default
3

Choosing the payment application

Terminal ⇄ Card

A chip can hold several applications. The terminal selects the Payment System Environment, reads its directory, and finds one payment application: Visa Credit. It then selects that application by its AID (application identifier). The card answers with its label, priority and preferred languages (Portuguese, then English).

Selected AID
A0000000031010Visa Credit/Debit
50 Label
VISA CREDIT
5F2D Languages
pt, en
4

Get Processing Options: the card says what it can do

Terminal ⇄ Card

The terminal starts the transaction on the card. The card answers with its Application Interchange Profile (AIP), what it supports, and its Application File Locator (AFL), where its records are. The card also adds one to its Application Transaction Counter: 0026 becomes 0027. The issuer will check that counter later.

82 AIP
3800DDA, cardholder verification, terminal risk management
94 AFL
08 01 01 00 10 01 01 01 18 01 02 00
9F36 ATC
0027was 0026
5

Reading the card's records

Card → POS terminal

Following the AFL, the terminal reads four records. Together they hold the card number, expiry, the Track 2 equivalent data (with the iCVV 859 the issuer will check, and the PIN verification value 3798, a copy of a value the issuer also keeps in its own records), the list of accepted cardholder verification methods, the data lists for the cryptograms (CDOL1 and CDOL2), the issuer's action codes, and the certificates for offline authentication.

5A PAN
4761739001010010
5F24 Expiry
281231
57 Track 2 equivalent
4761739001010010D28122011379885900000F
8E CVM list
00 00 00 00 00 00 00 00 42 03 1E 03 1F 03online PIN, then signature, then no CVM
8C CDOL1
9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03 9C 01 9F 37 04
6

Offline data authentication: checking that the card is genuine

Terminal ⇄ Card

The terminal checks the card without going online, with a chain of RSA signatures. The card network's CA signed the issuer's key; the issuer signed the card's key and its static data; the card signs a challenge from the terminal with its own private key, which never leaves the chip. A copied card has the certificates but not that private key, so it cannot sign. This is DDA (dynamic data authentication). The keys here are demo keys made for this page, and the signatures are computed live.

CA key
A000000003 index 99demo key, 1024 bits
Issuer certificate
recovered, hash matches
Card certificate
recovered, hash matches
Signed dynamic data
signature valid
7

Processing restrictions: versions, usage control and dates

POS terminal

The terminal compares the card with the sale. It checks that the application versions are compatible, that the card's usage control allows a domestic purchase, and that the card is already effective and not expired. Anything wrong is recorded in the TVR; the terminal does not decide yet.

Application version
card 0096, terminal 0096
Usage control 9F07
FF00domestic goods allowed
Effective 5F25
231201
Expiry 5F24
281231valid on 30 Nov 2026
95 TVR
0000000000
8

The cardholder types the PIN

PIN pad

The terminal walks the card's CVM list. The first rule, "enciphered PIN verified online, if the terminal supports it", applies, so the PIN is checked by the issuer, not by the chip. The PIN pad builds an ISO 9564 format 0 PIN block (the PIN mixed with the card number) and encrypts it at once under its PIN key. The clear PIN exists only inside the PIN pad.

CVM rule used
42 03enciphered PIN, verified online; if the terminal supports it
PIN typed
****4 digits
PIN block under the TPK
3EE2AC8B1F315DD9
9F34 CVM results
420300online PIN; result unknown until the issuer answers
9

Terminal risk management

POS terminal

The card asked for terminal risk management (AIP byte 1 bit 4). The terminal checks the floor limit: BRL 25.50 is above the floor limit of BRL 0.00, and equal counts as exceeding it, so the transaction must go online. Random selection would send some small transactions online anyway; velocity checking would count offline transactions, but this card has no offline limits, so it is skipped.

Floor limit
BRL 0.00reached: amount ≥ floor limit
Random selection
not needed (already online)
Velocity checking
not performedno 9F14 / 9F23 limits on the card
95 TVR
0000048000
10

Terminal action analysis: AAC, TC or ARQC

POS terminal → Card

The terminal compares every TVR bit with two sets of action codes: the issuer's (IAC, from the card) and the acquirer's (TAC, in the terminal). A bit in the denial codes means decline offline; a bit in the online codes means ask the issuer. Here the online PIN bit is set and both online codes include it, so the terminal asks the card for an online cryptogram: an ARQC.

95 TVR
0000048000
TVR AND (TAC ∨ IAC) denial
0000000000
TVR AND (TAC ∨ IAC) online
0000048000
GENERATE AC P1
80ARQC
11

The chip computes the ARQC

Card → POS terminal

The chip proves it is genuine and that it saw these exact details. It derives a session key from its card key and the counter (ATC 0027), then computes a MAC over the transaction data with that session key. The card key was put in the chip at personalisation, derived from the issuer's master key, the card number and the PAN sequence number; only the issuer can derive it again.

9F27 Cryptogram information
80ARQC: go online
9F36 ATC
0027
9F26 Application cryptogram
7907A0DA25CD7A94
9F10 Issuer application data
06 01 12 03 A0 00 02DKI 01 · CVN 18 · CVR 03A00002
12

The terminal sends an authorisation request

POS terminal → Acquirer

The terminal packs the sale, the card data, the encrypted PIN block and the chip data into an ISO 8583 message: a message type (0100, authorisation request), a bitmap saying which fields follow, and the fields. Field 55 carries the EMV data the issuer needs, each element as a BER-TLV data object: values from the card (cryptogram, ATC, issuer application data, AIP) and from the terminal (amount, date, TVR, unpredictable number, CVM results). The terminal assembles it from the values it holds; it is not a copy of one card response.

MTI
0100authorisation request
Bitmap
703C468028E09200
DE 4 Amount
000000002550
DE 22 Entry mode
051chip read, PIN can be entered
DE 52 PIN block
3EE2AC8B1F315DD9under the terminal PIN key
DE 55 Chip data
114 bytescard and terminal EMV data as BER-TLV: ARQC, IAD, ATC, TVR, UN…
13

Acquirer: merchant checks, PIN translation, routing

Acquirer → Card network

The acquirer is the merchant's bank. It checks that the terminal and merchant are known and allowed to take this kind of sale, adds its own institution ID and the transmission time, and finds the card network from the card number: Visa. The PIN block cannot travel under the terminal's key, so the acquirer's HSM (hardware security module) decrypts it and re-encrypts it under the zone PIN key it shares with the network. The clear PIN block exists only inside the HSM.

Merchant / terminal
IDNTEQDEMO00001 / TERM0042known, active
Luhn check digit
valid
Network from BIN
Visa
DE 52 after translation
D36B812AFE69F224under the acquirer–network zone PIN key
14

Card network: routing by BIN and a risk score

Card network → Issuer processor

The network looks up the first digits of the card number (the BIN, 476173) in its routing table to find the issuer and the processor that authorises for it. Its HSM translates the PIN block again, to the key shared with that processor. It adds a fraud score from what it sees across all merchants and issuers, and keeps rules ready to answer on the issuer's behalf (stand-in) if the issuer does not reply in time.

BIN
476173Visa
Issuer / processor
Banco Demo S.A. / Demo Issuer Processing
DE 52 after translation
B24B8E54FCB1DF85under the network–issuer zone PIN key
Network risk score
5illustrative, 0–99
15

Issuer processor: the cryptographic checks

Issuer processor + HSM

The issuer's processor hands the cryptography to its HSM. The HSM derives the card key again from the issuer master key, then the session key from the ATC, and recomputes the cryptogram: if it matches, the card holds the issuer's key and the amount, date and other data are exactly what the chip saw. It checks the iCVV in the Track 2 data, and the PIN: it decrypts the PIN block, computes the PVV of the PIN typed and compares it with the PVV in the issuer's own records. It also compares the counter with the highest one it has seen for this card. This page's issuer accepts only a counter that moves forward; real issuers also detect duplicates and allow for retries and messages that arrive late.

ARQC
match7907A0DA25CD7A94
iCVV
match859 = 859
PIN
correctPVV of the PIN typed 3798, on file 3798
ATC
moves forward0027 after 0026
16

Issuer bank: the account

Issuer processor ⇄ Issuer bank

The processor asks the bank's core system for the card status and validity, the available balance and the remaining PIN tries. If the sale is approved, the bank places a hold of BRL 25.50, so the money cannot be spent twice before it is cleared.

Card status
active
Expiry
valid
Available balance
BRL 1,200.00enough for BRL 25.50
PIN tries left
3
Hold placed
BRL 25.50available afterwards BRL 1,174.50
17

Fraud rules and the decision

Issuer bank → Issuer processor

A rules engine scores the transaction: the amount against the cardholder's usual spending, where the card is used, the kind of merchant, how often the card was used recently, the terminal's results and the network's score. The first check that fails sets the response code; if all pass and the score is low, the sale is approved. These rules and weights are illustrative: every issuer tunes its own, often with machine-learning models.

DE 39 Response code
00 · Approved
Reason
every check passed
Fraud score
1 / 100low
DE 38 Authorisation code
977656
18

The issuer answers, with an ARPC for the chip

Issuer processor

The issuer builds the 0110 response with the response code 00 and an authorisation code. For the chip it adds issuer authentication data (tag 91, 8 bytes): a Card Status Update (CSU), 4 bytes that tell the card the issuer's decision, and an ARPC, the leftmost 4 bytes of a MAC over the ARQC it received and the CSU, under the card's session key. This is ARPC method 2, the one CVN 18 uses. The chip will check it, so nobody between the issuer and the card can turn a decline into an approval or change the CSU.

DE 39 Response code
00Approved
DE 38 Authorisation code
977656
CSU
00800000issuer approves
ARPC
541C7133method 2, 4 bytes
DE 55 tag 91 Issuer authentication data
541C713300800000ARPC ‖ CSU
19

The response travels back

Issuer processor → Network → Acquirer → Terminal

The response goes back the way the request came: issuer processor, network, acquirer, terminal. Each matches it to its request by the STAN, the retrieval reference number and the terminal ID, and logs it. Here the issuer answers in time. When it does not, the network's and acquirer's rules decide: the network may answer for the issuer with stand-in rules, and the acquirer may reverse an approval that arrives too late (the path "No answer from the issuer" shows both).

DE 11 STAN
004127
DE 37 RRN
633414004127year digit, day 334, hour, STAN
DE 39
00 · Approved
20

The chip checks the issuer and returns the final cryptogram

Terminal ⇄ Card

This card takes the issuer's answer inside the second GENERATE AC. Its AIP does not announce issuer authentication, so the terminal sends no EXTERNAL AUTHENTICATE; instead the card's CDOL2 asks for the response code (8A) and the issuer authentication data (91), and the terminal puts both into the command. The chip computes the ARPC itself, over its own ARQC and the CSU it received, with its own session key: it matches, so the CSU comes from the issuer. It then follows the CSU: the issuer approves, so the chip returns the TC the terminal asked for. The terminal does not see the issuer authentication result itself, only the TC or AAC and the CVR inside the issuer application data. The final cryptogram is kept for clearing and disputes as proof of the outcome.

ARPC check on the chip
matchissuer 541C7133, chip 541C7133
CSU
00800000approve: return the TC the terminal asked for
GENERATE AC P1
40TC requested
9F27
40TC: approved
9F26
E1A3FE4B77B68F5E
95 TVR (final)
0000048000
21

Receipt

POS terminal

The terminal shows the result and prints the slip. Besides the amount and the masked card number, it carries the technical record a support team needs: the AID, the TVR and TSI, and the final cryptogram.

Result
Approved, auth code 977656
9B TSI
E800ODA, CVM, card risk management, terminal risk management performed (performed, not necessarily passed); issuer authentication happened inside the card, so the terminal does not mark it
22

Clearing: the sale becomes final

Terminal → Acquirer → Network → Issuer

At the end of the day the terminal closes its batch. The acquirer sends each approved sale to the network as a clearing record (Visa calls it a sales draft) with the amount, the authorisation code and the chip data with the TC. The network passes it to the issuer, which matches it to the authorisation and turns the hold into a posted transaction on the statement.

Amount
BRL 25.50
Authorisation code
977656
TC
E1A3FE4B77B68F5E
Issuer
hold → posted
23

Settlement: the money and the fees

Issuer → Network → Acquirer → Merchant

The network nets every issuer's and acquirer's positions and moves the money, usually a day or more later. The issuer pays the amount less interchange (its fee for issuing the card); the network charges scheme fees; the acquirer pays the merchant the amount less the merchant discount rate it agreed with them. The rates here are illustrative. Each fee is calculated in whole minor units and rounded to the nearest one, halves up; real agreements set their own rounding rules.

Cardholder pays
BRL 25.50
Issuer keeps (interchange)
BRL 0.281.10%
Network (scheme fees)
BRL 0.030.10%
Acquirer keeps
BRL 0.20merchant discount less interchange and scheme fees
Merchant receives
BRL 24.99amount less 2.00%

What this walkthrough simplifies

The tools behind it

Each calculation on this page is one of the site's tools. Open them to work with your own data:

For training for your team, with your own cards and logs, see EMV for Developers or get in touch.

Terms are explained in the EMV and payments glossary.