Skip to main content
iso8583sim.demo This module provides convenient functions for:
  • Pretty-printing ISO 8583 messages
  • Generating sample messages for different scenarios
  • Explaining message components

Functions

pretty_print()

Pretty print an ISO 8583 message. Parameters
ISO8583Message | str
required
ISO8583Message object or raw message string
bool
default:"False"
Whether to show the raw message bytes

explain_field()

Explain a specific field’s definition and optionally its value. Parameters
int
required
The field number to explain
str | None
default:"None"
Optional field value to interpret

generate_auth_request()

Generate a sample authorization request. Parameters
str
default:"'4111111111111111'"
Primary Account Number
int
default:"1000"
Transaction amount in cents
str
default:"'123456'"
System Trace Audit Number
str
default:"'TERM0001'"
Terminal ID (8 chars)
str
default:"'MERCHANT123456 '"
Merchant ID (15 chars)
CardNetwork | None
default:"None"
Optional network type
ISO8583Message
ISO8583Message object

generate_financial_request()

Generate a sample financial request (0200). Parameters
str
default:"'4111111111111111'"
Primary Account Number
int
default:"5000"
Transaction amount in cents
str
default:"'654321'"
System Trace Audit Number
str
default:"'000000'"
Processing code (default: purchase)
ISO8583Message
ISO8583Message object

generate_reversal()

Generate a reversal message for an original transaction. Parameters
ISO8583Message
required
The original transaction message
str
default:"'999999'"
New STAN for the reversal
ISO8583Message
ISO8583Message reversal

generate_network_message()

Generate a network management message. Parameters
str
default:"'echo'"
Type of message - ‘echo’, ‘signon’, ‘signoff’, ‘key_exchange’
ISO8583Message
ISO8583Message object

generate_emv_auth()

Generate an EMV chip card authorization. Parameters
str
default:"'4111111111111111'"
Primary Account Number
int
default:"10000"
Transaction amount in cents
str
default:"'AABBCCDD11223344'"
Application cryptogram (8 bytes hex)
ISO8583Message
ISO8583Message with EMV data

build_and_parse()

Build a message to raw format and parse it back. Useful for testing roundtrip. Parameters
ISO8583Message
required
ISO8583Message to process
ISO8583Message
Parsed message

validate()

Validate a message and print results. Parameters
ISO8583Message | str
required
ISO8583Message or raw message string

explain_emv()

Parse and explain EMV data. Parameters
str
required
Hex-encoded EMV TLV data