Skip to content

nexo

nexo standards is an association that writes open standards for card payments in Europe. Its standards cover what a payment terminal says to the systems around it, and how a payment application behaves. a7pay implements the terminal’s side of them in the nexo crate. Terms in bold are in the glossary.

A terminal talks to three systems. nexo defines one protocol for each, as ISO 20022 XML messages:

Protocol Between the terminal and For In a7pay
Acquirer protocol (CAPE caaa) Its acquirer Authorisations, the advices confirming or reversing them, cancellations, reconciliation (end-of-day totals), batch capture nexo::acquirer
TMS protocol (CAPE catm, TMAP) Its terminal management system Status reports, management plans (what to do and when), configuration downloads nexo::tms
Retailer protocol (CASP, “Sale to POI”) The cash register Payment, refund and reversal requests, reconciliation nexo::retailer

On top of the protocols, nexo FAST specifies the payment application itself:

  • how a payment, a refund or a cancellation runs from the tap to the host and back;
  • how the terminal’s configuration is laid out;
  • which application to choose when several fit.

a7pay targets nexo IS v5: the message versions are the ones its message usage guides use (caaa.001.001.09, …), not the latest ISO 20022 versions.

The protocols are sans-IO: they build messages and classify what is received, and the caller moves the bytes. A terminal sends them over its own network stack. For the test environment, nexo::net (feature nexo-net) does it over TCP, with nexo’s message framing.

Acquirer (nexo::acquirer):

  • exchange::Exchange runs one exchange: authorisation, cancellation, completion or cancellation advice, reconciliation, diagnostic. It classifies every message received as the acquirer message usage guide says: the response, one to ignore, or a failure leading to a reversal, a retransmission or the end.
  • completion builds the advices confirming or reversing a transaction.
  • outcome applies nexo IS’s outcome tables.
  • log is the terminal’s transaction log, with its storage limits and recovery of pending advices.
  • reconciliation computes the period’s totals.
  • batch captures transactions by batch instead of one advice each.
  • host is the acquirer’s side, for simulators.

TMS (nexo::tms):

  • session runs status reports;
  • plan validates management plans, and execution::PlanExecutor carries out their actions: sequences, start times, periods, retries;
  • config stores configuration updates with the create, update and delete rules;
  • event::EventLog keeps events until they are reported;
  • host is the terminal manager’s side.

Retailer (nexo::retailer):

  • poi::PoiSystem is the terminal’s side: it rejects malformed requests, enforces the dialogue rules, answers status queries, and hands the application typed requests;
  • payment, reversal and reconciliation build and read those messages, on both sides.

Security (nexo::security):

  • MAC protection of the messages;
  • card data encryption;
  • the enciphered online PIN;

under DUKPT, AES DUKPT and UKPT keys. Every key operation goes through the platform’s SecurityModule (see Platform): nexo holds no keys. A received message’s MAC is checked on its body exactly as received, never on a re-serialised copy.

nexo::fast runs FAST’s contactless card services on emvco’s Entry Point and kernels:

Module What it does
config Installs the configuration templates (nexo IS 4.5, E0 to F2) a TMS sends, with their update rules
selection FAST’s application selection, between Entry Point’s Combination Selection and Kernel Activation: AID preferences, the EEA process with the cardholder’s choice of application, application profiles
kernel FAST’s mapping of data to and from the kernels
card_service::CardService Payment, Refund and Cancellation, as a sequence of steps the terminal answers (Step::Card, Step::PinEntry, Step::SearchLog, …, Step::Done), from the tap to the host exchange and the advice to send
hapi Builds the acquirer requests and advices from the transaction’s data, and applies the responses: online PIN, resubmission when the issuer asks for a PIN, protected card data
log FAST’s side of the transaction log: searching it for a cancellation, its storage rules

Kernels: FAST’s contactless kernels are 2, 3, 4 and 6, with Kernel 3’s issuer update. Kernel 8 postdates FAST 3.3, so it is added with a7pay’s own mapping:

  • its configuration is built from FAST’s data elements and the application profile’s own Kernel 8 tags;
  • its ECC CA keys go in template E3, as an extension.

Not done yet:

  • FAST’s other services (pre-authorisation, …);
  • the contact and magnetic stripe kernels;
  • receipts and attendant interactions.

Where the nexo documents contradict each other, a7pay picks one reading and documents it where it is applied:

  • Reconciliation uses SFRQ/SFRP: the message usage guide’s FSCQ/FSCP aren’t in the schema’s code list.
  • SFSQ is accepted for reconciliation, administrative and report requests, as the guide’s examples send it.
  • Terminal Settings is accepted as 2 to 5 bytes: nexo IS 4.5 says 2, but nexo IS 5.1 uses its third byte for Cancellation.

Tested against the specifications’ own examples

Section titled “Tested against the specifications’ own examples”

When the specification copies are present (they skip otherwise), crates/a7pay-nexo/tests/:

  • parses and round-trips every XML example of the nexo documents (spec_examples.rs);
  • verifies their MACs (spec_macs.rs);
  • deciphers their protected card data (spec_card_data.rs);
  • replays their exchanges (spec_exchanges.rs);
  • feeds the sale system’s examples to a PoiSystem (spec_retailer.rs).

Errors found in the nexo documents themselves are listed there.

cargo test -p a7pay-nexo --features l3

The message types (nexo::iso20022::types) are generated from the ISO 20022 schemas by nexo-codegen: see Building.