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
All values: keys, card, issuer records, fees
The cashier enters the amount
POS terminalThe 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
The card is inserted: power and Answer To Reset
Card → POS terminalThe 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
Choosing the payment application
Terminal ⇄ CardA 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
Get Processing Options: the card says what it can do
Terminal ⇄ CardThe 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
Reading the card's records
Card → POS terminalFollowing 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
Offline data authentication: checking that the card is genuine
Terminal ⇄ CardThe 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
Processing restrictions: versions, usage control and dates
POS terminalThe 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
The cardholder types the PIN
PIN padThe 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
Terminal risk management
POS terminalThe 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
Terminal action analysis: AAC, TC or ARQC
POS terminal → CardThe 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
The chip computes the ARQC
Card → POS terminalThe 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
The terminal sends an authorisation request
POS terminal → AcquirerThe 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…
Acquirer: merchant checks, PIN translation, routing
Acquirer → Card networkThe 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
Card network: routing by BIN and a risk score
Card network → Issuer processorThe 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
Issuer processor: the cryptographic checks
Issuer processor + HSMThe 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
Issuer bank: the account
Issuer processor ⇄ Issuer bankThe 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
Fraud rules and the decision
Issuer bank → Issuer processorA 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
The issuer answers, with an ARPC for the chip
Issuer processorThe 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
The response travels back
Issuer processor → Network → Acquirer → TerminalThe 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
The chip checks the issuer and returns the final cryptogram
Terminal ⇄ CardThis 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
Receipt
POS terminalThe 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
Clearing: the sale becomes final
Terminal → Acquirer → Network → IssuerAt 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
Settlement: the money and the fees
Issuer → Network → Acquirer → MerchantThe 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
- It follows a contact chip card with an online PIN. Contactless payments run a different kernel, with its own commands and cardholder verification rules: a low-value contactless purchase often needs no PIN and often ends after the first cryptogram, but the limits and the card's and reader's settings decide, and contactless payments can also use online PIN or verification on the phone. The contactless walkthrough follows one Visa (Kernel 3) tap step by step.
- The cryptograms follow Visa CVN 10 and CVN 18 (choose one under "All values"). The ARQC verifier reproduces the published examples for both: AWS Payment Cryptography for the ARQCs, and the pyemv library for the CVN 18 card key (Option B) and ARPC. Other versions, such as Mastercard's, use other data and, in some versions, other session keys.
- The issuer's answer follows the selected version. CVN 10: ARPC method 1 (an 8-byte ARPC with the response code), sent to the card with EXTERNAL AUTHENTICATE. CVN 18: ARPC method 2 (a 4-byte ARPC with a Card Status Update), checked by the card inside the second GENERATE AC.
- Approved, then declined by the card: the fault that makes the card decline (tag 91 dropped by a host, or one byte changed) is illustrative, and so is the card setting that declines when issuer authentication fails or is missing; that is an issuer choice in the card. The reversal is shown as an 0400 with ISO 8583:1987 DE 90; networks also use 0420 reversal advices, repeats (0401, 0421), their own transaction identifiers and reason codes.
- No answer from the issuer: the timers, the stand-in rules and limit, and the keys the issuer shares with the network are illustrative. One late response is modelled; messages lost on the way back, a reversal that is not answered and other duplicates are described, not simulated.
- Offline approval and offline PIN failures use a different card from the online paths: its CVM list starts with offline PIN, and its issuer action codes and offline limits are illustrative. The terminal's random selection parameters are illustrative and its random number is taken from the unpredictable number; the last online ATC is set two transactions back. The card's own offline risk management (its internal counters) is not modelled: it returns the cryptogram the terminal asks for. Enciphered offline PIN uses the card's ICC public key (no separate PIN encipherment key), with padding derived from the transaction instead of random bytes so the page is repeatable.
- Issuer script: one script with one command. The secure messaging keys follow pyemv's Visa CVN 10 / 18 (MK ⊕ ATC, VIS PIN block) or, as an option, the EMV common session key with R = ARQC (as Visa CVN 22); Visa's own card specification is not public. The CVR script bits follow the public decoding the site's tag decoder uses. What the card does in the next transaction (a blocked application, the new PIN) is described, not simulated.
- The PIN pad uses one fixed key. Real PIN pads use DUKPT, a master/session key scheme or another managed key; none keep one key for good.
- The certificate authority, issuer and card RSA keys are demo keys made for this page.
- The fraud rules, network score, BIN table and fee rates are illustrative. Real issuers tune their own rules and models, and fees depend on the network, card type, country and merchant.
- The ISO 8583 messages use one common encoding (ASCII fields, a binary bitmap); each network and host has its own dialect and private fields.
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.