Skip to main content
Use it to test acquirer, switch or terminal software without a card network connection.
  • iso8583sim serve runs a mock issuer host that answers by rules.
  • iso8583sim send sends one message and shows the response.
  • iso8583sim load sends many requests and reports throughput and latency.
  • ISO8583Client and MockHost do the same from Python (asyncio).
Messages travel in a wire format (ASCII, BCD, EBCDIC…), each preceded by a length header and, optionally, a TPDU.

Quick start

In one terminal, start a mock host:
In another, generate a message and send it:
Or put it under load:

Framing options

All three commands take the same options, and both ends must agree on them: The length in the header covers everything after it, including the TPDU. On responses, the mock host swaps the TPDU’s destination and source addresses.

Mock host rules

Without a rules file, the mock host approves everything. A rules file lists rules in order; the first rule that matches a request decides the response.
Match conditions (all must hold): Actions: respond (default, with respond as the field 39 code), drop (no answer) or close (close the connection). delay_ms delays any action. Responses echo the request’s matching fields (PAN, processing code, amount, times, STAN, IDs, currency, field 70), set field 39, and add an approval code in field 38 for approved authorizations and financial requests. Rules files can be JSON or YAML (YAML needs pip install pyyaml). Press Ctrl+C (or send SIGTERM) to stop; the host prints a summary of what it received and how it answered.

Python API

The client matches responses to requests by STAN (field 11), so many requests can be in flight on one connection and responses may arrive in any order. Every request needs a STAN, and two requests waiting at the same time can’t share one. run_load runs a load test from Python and returns a LoadReport with counts, response codes and latency percentiles.

From an AI assistant

The MCP server has a send_to_host tool. To stop an assistant from being used to reach arbitrary machines, it only connects to hosts listed in the ISO8583SIM_ALLOWED_HOSTS environment variable of the MCP server. The default is this machine only (127.0.0.1,localhost,::1). Entries can be a host (any port) or host:port:

Performance

On an Apple M4 Pro, the client and mock host in one process handle about 12,000 round trips per second; with the host in a separate process, a load run reached about 20,000. See benchmarks/BASELINE.md and benchmarks/bench_network.py.