Skip to content

Entry Point

Entry Point (EMVCo Book B) is the part of the reader that runs before any kernel:

  • it watches for a card;
  • it finds out which payment applications the card has;
  • it picks the one to use and the kernel that runs it;
  • it hands over to that kernel, and reports what the kernel concluded.

It lives in emvco::l2::ep. Terms in bold are in the glossary.

A contactless card can carry several payment applications (a debit and a credit application, two schemes), and a reader supports several schemes, each with its own kernel. Entry Point is the common front door: the same logic for every scheme, so that each kernel only deals with its own cards.

A reader is configured with Combinations. A Combination is one AID the reader accepts, paired with the kernel that runs it, with that pair’s settings:

  • the contactless transaction limit: above it, the card can’t be used contactless;
  • the CVM required limit: above it, the cardholder must be verified;
  • the floor limit: above it, the payment must go online;
  • which zero-amount and status checks apply;
  • the configuration data the kernel takes (terminal capabilities, country, currency, …).

For example: Mastercard’s AID on Kernel 2, Visa’s on Kernel 3, each with a contactless limit of 50.00.

Step Book B What it does
Pre-Processing (Start A) 3.1 Before the card is tapped: compares the amount with each Combination’s limits, and works out what each kernel will need to know (e.g. “a CVM will be required”). A Combination whose contactless limit is exceeded is dropped.
Protocol Activation (Start B) 3.2 Turns the contactless field on, shows “Present card”, and polls until one card answers (two cards in the field is a collision: “Present one card only”).
Combination Selection (Start C) 3.3 Reads the card’s directory (the PPSE), matches each application with the Combinations, builds the candidate list, orders it by priority, and selects the first: SELECT of its AID.
Kernel Activation (Start D) 3.4 Hands control to the kernel of the selected Combination, with the card’s answer to SELECT, the Combination’s configuration and the transaction’s data. The kernel runs the transaction with the card until its Outcome.
Outcome Processing 3.5 Acts on the kernel’s Outcome: shows its message, and either ends the transaction or restarts at one of the steps above.

The kernel’s Outcome says how the transaction ends, or where it starts again:

Outcome What happens next
Approved, Declined The transaction ends.
Online Request The payment application sends the payment to the acquirer. Some kernels ask to be re-activated with the issuer’s answer (below).
Try Again Protocol Activation again (Start B): e.g. the card was taken away too early, so tap again.
Select Next Combination Selection again (Start C), with the next candidate: the card refused that application.
Try Another Interface The card must be inserted or swiped instead.
End Application The transaction ends, possibly with a restart, e.g. Kernel 2’s “See phone”: the cardholder confirms on the phone, then taps again.

Re-activation after an online authorisation (Book A 8.1.1.22). When a kernel’s Online Request asks for it, the terminal gives the kernel back the issuer’s answer: its authorisation response code and authentication data, and its scripts updating the card (tags ‘8A’, ‘91’, ‘71’, ‘72’). Two ways:

  • with a second tap (Start B): Entry Point selects the same Combination again;
  • without one (Start D): the kernel is activated directly, without a SELECT response.

Either way, Entry Point keeps the kernel’s data between the two activations (EpDb::kernel_restart_data). The terminal sets the issuer’s answer in EpDb::online_response_data.

EntryPoint takes the Reader and Crypto your platform implements (see Platform). It has one method per step. Kernel Activation drives the selected kernel all the way to its Outcome: you never run a kernel directly.

use a7pay::emvco::l2::ep::EntryPoint;

let mut ep = EntryPoint::new(&mut reader, &mut crypto);
ep.pre_processing(amount);                          // Start A
ep.protocol_activation(true)?;                      // Start B: wait for a card
let selected = ep.combination_selection(true)?;     // Start C: PPSE, then SELECT the AID
let run = ep.kernel_activation(                     // Start D: the kernel runs
    Some(&select_aid_response), &ca_public_keys, &transaction_data, None,
)?;
ep.outcome_processing(/* the kernel's Outcome */)?;

Rather than writing the loop and its restarts yourself, use the reader’s transaction, a7pay::emvco::l2::transaction (Book A’s reader around Entry Point; the one the Level 2 test agent runs, so the behaviour certified is the product’s):

use a7pay::emvco::l2::transaction::{TerminalProcessing, TransactionInput, run_transaction};

let input = TransactionInput {
    combinations,                     // the reader's Combinations
    ca_public_keys,                   // the schemes' public keys, for ODA
    amount_authorised: Some(1250),    // 12.50
    amount_other: 0,
    transaction_currency_code: 978,   // euro
    transaction_currency_exponent: 2,
    transaction_date: [0x26, 0x11, 0x29],
    transaction_type: 0x00,           // purchase
    additional_data: vec![],          // other transaction data ('9F21', ...)
    entry_point_error_ui: Default::default(),
    list_of_aids_on_ppse_not_found: false,
    ppse_df_name_required: false,
    try_again_ends_transaction: false,
    online_response: None,            // the issuer's answer, to re-activate the kernel
    exception_file: None,
    tearing_log: None,
};
// What some kernels ask the terminal beyond its configuration (Kernel 6's operator, ...).
let processing = TerminalProcessing::default();
let outcome = run_transaction(&mut reader, &mut crypto, input, processing, |signal| {
    // every message and Outcome, as it happens: show it on the display
})?;
println!("{:?}", outcome.final_outcome);

run_transaction runs the five steps and restarts where Book B says to:

  • Try Again at Start B, Select Next at Start C;
  • End Application with a restart;
  • a communication error with the card: Start B again;
  • a bounded number of attempts, so that a faulty card can’t loop forever.

The callback receives every signal:

  • each kernel message (“Authorising, please wait”, “See phone”);
  • each Outcome;
  • Entry Point’s own messages (“Present card”);

each saying where it comes from (SignalSource). The result carries the final Outcome with its parameters, the display requests and the error indication, encoded as Book A defines them. A transaction that ends without a final Outcome gives a TransactionFailure saying why.

Field of TransactionInput What it is
combinations The reader’s Combinations
ca_public_keys The schemes’ CA public keys, for offline data authentication
amount_authorised, amount_other, transaction_currency_code, transaction_currency_exponent, transaction_date, transaction_type The transaction
additional_data Other transaction data the kernels may need: time (‘9F21’), merchant data, …
online_response The issuer’s answer, to re-activate the kernel after an Online Request. None: the transaction ends at the Online Request
exception_file The terminal’s list of blocked card numbers, checked by Kernels 3 and 6
tearing_log Kernel 6’s Tearing Log, with feature c6 (see Kernels)
entry_point_error_ui, list_of_aids_on_ppse_not_found, ppse_df_name_required, try_again_ends_transaction Reader behaviours some schemes expect (below)

The terminal’s own logic, which some kernels call on beyond their configuration, goes in TerminalProcessing (none by default):

Field of TerminalProcessing What it is
operator Kernel 6’s operator, for Data Storage and Extended Logging (see Kernels)
data_exchange Kernel 2’s and Kernel 8’s Data Exchange with the terminal (see Kernels)
ids_operator Kernel 3’s IDS Operator Application (see Kernels)

Where schemes’ readers differ from Book B

Section titled “Where schemes’ readers differ from Book B”

Some schemes certify readers that behave slightly differently from Book B at the Entry Point level. These aren’t build features (one reader serves every scheme): they are settings of the transaction. Each defaults to Book B’s behaviour.

Setting Book B The alternative
entry_point_error_ui Entry Point’s own errors shown as Book B says Mastercard readers’ “Not ready” with a hold time; American Express readers’ “Processing error” first
list_of_aids_on_ppse_not_found A card without a PPSE has no contactless application Try the reader’s own list of AIDs (EMV Book 1 12.3.3), as American Express readers do
ppse_df_name_required The PPSE’s answer may leave out its name (‘84’) Require it, as Mastercard readers do
try_again_ends_transaction Try Again restarts the transaction at Start B End the transaction, the next tap starting a new one, as American Express readers do
  • Book B 3.3.1a (SEND POI INFORMATION) and Application Selection Registered Proprietary Data: out of scope, as documented in ep/cs.rs.
  • nexo FAST does its own application selection between Combination Selection and Kernel Activation (preferences, profiles, the cardholder’s choice). Entry Point offers two hooks for it, inert by default: see nexo.