ISO 8583 · Python 3.9+ · MIT

The message toolkit that reads like the spec.

Parse, build, and validate ISO 8583 financial messages — with a Python SDK, a CLI, and LLM-assisted explanation for the standard behind every card transaction.

$pip install iso8583sim
Quick start
182k
parse TPS
6
card networks
3
ISO versions
Primary bitmap0100 · auth request

MTI 0100 · BMP 72 38 00 01 08 20 80 00
DE 2·3·4·7·11·12·13·32·37·43·49 present

bit set — field present bit clear
01 — THROUGHPUT

Cython fast path

182k parse / 150k build TPS, with a pure-Python fallback when native extensions aren't built.

02 — NETWORKS

Every major scheme

VISA, Mastercard, AMEX, Discover, JCB, and UnionPay, each with scheme-specific field rules.

03 — EMV

Field 55 TLV

Full chip-card data parsing and building over BER-TLV, tag by tag.

04 — AI

Explain & generate

Read a message in plain English, or generate one from a sentence — OpenAI, Claude, Gemini, or Ollama.

A raw byte stream in. A structured message out.

One call decomposes the wire format into its message type, bitmap, and data elements — validated against the ISO version and, optionally, the card network.

from iso8583sim.core.parser import ISO8583Parser

parser = ISO8583Parser()
parsed = parser.parse(raw)          # raw ISO 8583 message

parsed.mti                          # '0100'  — authorization request
parsed.fields[2]                    # '4111111111111111'  — PAN
parsed.fields[4]                    # '000000001000'  — amount, minor units

# Round-trip it back to the wire
from iso8583sim.core.builder import ISO8583Builder
ISO8583Builder().build(parsed) == raw   # True
Parsed · ISO 198711 data elements
FieldValueMeaning
MTI0100Authorization request
BMP7238 0001…Primary bitmap
DE 24111 11•• •••• 1111Primary account number
DE 3000000Processing code — purchase
DE 4000000001000Amount — $10.00
DE 11123456System trace audit number
validate() → ✓ no errors0.6 µs

Three ways to reach for it.

The same core, exposed however you work — embedded in a service, driven from a shell, or explored interactively.

Python SDK
builder = ISO8583Builder()
msg = ISO8583Message(
    mti="0100",
    fields={
        2:  "4111111111111111",
        4:  "000000001000",
        11: "123456",
        41: "TERM0001",
    },
)
raw = builder.build(msg)

Typed messages, strict validation, object pooling for high-throughput services.

Command line
$ iso8583sim parse "0100…" \
    --version 1987

$ iso8583sim build \
    --mti 0100 --fields fields.json

$ iso8583sim generate \
    --type auth --amount 1000

Parse, build, validate, and generate sample messages without writing a line of Python.

Notebooks
notebooks/
  01_getting_started.ipynb
  02_parsing_messages.ipynb
  04_network_specifics.ipynb
  05_emv_data.ipynb
  07_llm_features.ipynb
  08_llm_features_ollama.ipynb

Eight runnable notebooks that teach ISO 8583 from first message to EMV and AI.

Speaks every major card network.

Each scheme carries its own BIN ranges and field conventions. The validator knows them, so your test traffic looks like the real thing.

VISA IIN 4
DE 22DE 25DE 55
Mastercard IIN 51–55 · 2221–2720
DE 22DE 48DE 55
American Express IIN 34 · 37
DE 4DE 44DE 55
Discover IIN 6011 · 65
DE 22DE 55
JCB IIN 3528–3589
DE 22DE 55
UnionPay IIN 62
DE 22DE 55

Ask what a message means. Or describe one and get it back.

The LLM layer sits on top of the parser, so explanations are grounded in a real decode — not a guess. Bring your own provider, cloud or fully offline.

explainer.explain(message)

“A $100.00 VISA purchase authorization at a gas station. The card expires December 2026 and was read via chip (EMV). Expect an 0110 response with code 00 (approved) or 51 (insufficient funds).”

Providerspip install iso8583sim[…]
ProviderModelRuns
OpenAIGPT-4oCloud
AnthropicClaudeCloud
GoogleGeminiCloud
OllamaLlama · Qwen · MistralLocal / offline

Built to run at line rate.

Optional Cython extensions push the hot paths past 180k transactions per second. Benchmarks on Apple Silicon (M-series), Python 3.12.

Parse
182k
Build
150k
Roundtrip
63k

TPS with Cython fast path. Higher is better.

Operationpure / cython
OperationPure PythonWith Cython
Parse~105k TPS~182k TPS
Build~150k TPS~150k TPS
Roundtrip~49k TPS~63k TPS

GET STARTED

Install it, and read your first message in a minute.

Free and open source under the MIT License.

$pip install iso8583sim
View on GitHub ↗