Iso8583  message structure

Iso8583  message structure

alloha.

at last i have been able to get my lazy behind to write a blog post on this.

About time :).

This will be the first in a series about parsing iso8583 financial messages  using erlang.

we will get to know

  • about iso8583 and the message structure
  • receiving iso 8583 messages over the wire using erlang tcp server
  • and parsing the message . parsing those messages in various formats(text(acii),binary,custom format).

Here we go.

Simply put it is a protocol which specificies the content of financial transaction done with payment cards in the form of request/response messages as well as info on how to process the financial transaction.

More general info can be found on the wikipedia page about it.

  • optional header .

    optional zero padded header showing size of message.

    Header size is known in advance by receipient and is specified by sender .

    Usually contains size of message ony but may contain size of header + size of message .

    An  example of a header is 0158 which means the content of the message(mti+bitmap+data elements) is 158 bytes 

  • mti(message type indicator).

    A 4 digit  number showing info about the message . each digit shows some info about the message .

    example of an mti is 1200 meaning with the meaning below.

    • 1 - first digit is message version - 1 message class means 1993 version

    • 2 - second digit specifies the message class(purpose of message)  eg. authorization,reversal.etc.. 2 means financial message

    • 0 - third digit specifies message function(how the message should flow within system) -eg. requests,advices,etc..  0 means request

    • 0 - fourth digit specifies message origin (where is the message coming from ) eg. from acquirer,issue etc..

      0 can means acquirer bitmap(primary or secondary).

  • A Bitmap

    This is a 16/32 hexadecimal number showing the presence or absence of data elements .

    A bitmap can be a primary or a secondary bitmap.

    Primary means presence of  fields from 1-64 .

    Secondary means the presence of presence of fields greater than 64 means 64-128 .

    The bitmap has to be converted from hex form to binary form where each binary digit represent presence or absence of a data element .

    If the first digit of the bitmap in binary form is 1 it means bitmap has fields greater than 64 which makes it a secondary bitmap.

    An example of a bitmap is

 
    F230040102B000000000000004000000

meaning fields

    1,2,3,4,7,11,12,22,32,39,41,43,44,102

are present and bitmap is a secondary bitmap due to fields greater than 64 being present

  • Data elements .

    These are the  actual contents of  the financial message such as the amount of the transaction,currecy,transaction type(balance enquiry,withdrawal,etc..),card number.

    There are 128 data elements from 1-128.

    What variants of iso messages are available?

    There are a few differnt variants of the iso8583 messaging format but  the most common ones are (1987 format/1993 format /2003 format ).

    The specification of  the various variants specify  the position of the various data elements  as well as what format the message will be transmitted in proprietery/custom ones also exist based on the above ones which may be cusom format agreed to be used between two parties or internal format for one party.

    How are messages processed ?

    Financial messages consist of request/response messages are sent between two entities to process financial transactions  .

    A tcp connection or other connection type(UDP, X.25, SDLC, SNA,ASYNC, QTP, SSL, HTTP,custom) is opened between the two entities.

    Some handshake mechanism may be done to prepare both parties for sending messages  .

    Messages are sent consisting of a request/response message.

    Depending on connection type a persistant connection may be kept open or a connection may be closed and reopened later for subsequent messages to be sent and received.<

    What to keep in mind when processing messages ?

    Message format (ascii,binary,custom format).

    eg 1993 acii,1993 binary.

    In what format the message will be transmitted in as well as rules to encode/decode the message.

    Wire protocol (TCP/IP,UDP, X.25, SDLC, SNA,ASYNC, QTP, SSL, HTTP,custom protocol).

    how a message is transmitted over the wire.

    Next post will be about using erlang to extract the various component (mti,bitmap,data elements) out of a message using a spec . 


Read more