Sunday, February 10, 2013

ISO 8583 message, a clear concept and the complete java solution download


I am sorry. Not able to provide the java solution from now. 

(not for production)

What is ISO 8583 message and Its using?

Interchange the DATA that takes place between one system to another system needs to follow standard formats for integration and exchange. There are many such standards exist. ISO 8583 message format is using for financial transaction such as ATM, POS, Credit Card, Mobile Banking, Internet Banking, KIOSK, e-commerce etc. transactions

Financial transaction is communication between 2 systems through socket connection. After connection established, each system can send message in ISO 8583 format which commonly will be request and the other system will response. Following scenarios can occurs.

  • System A request connection to System B (through specific IP and Port).
  • Connection established.
  • System A send Sign-On request message.
  • System B send Sign-on response message.
  • System A will start send Echo request message periodically (e.g every 30 seconds).
  • System B will send Echo response message when receive Echo request message.
  • When financial transaction happens, System A will send Transaction request message.
  • Then System B will send Transaction response message.
  • If something wrong happen (usually timeout so System A didn’t get the response), System A will send Reversal request message to cancel the previous transaction.
  • System B will send Reversal response message.

Now the practically explanation of ISO 8583 Messaging

Someone can ask you to generate a ISO 8583 (version 1987) financial request (Internet banking funds transfer) message by the following fields.  (Just an example)

So what you do?

Internet Banking Funds Transfer
FIELD
NAME OF THE FIELD
FORMAT
CHARS
LENGTH
CODING
SAMPLE DATA
2
Primary Account Number
HLVAR
n
7-19
1000001111222230
3
Processing Code
FIXED
n
6
280000
4
Amount Transaction
FIXED
n
12
000001000000
5
Settlement Amount
FIXED
n
12
000001000000
6
Amount, Cardholder Billing
FIXED
n
12
000001000000
7
Transmission Date & Time
FIXED
n
10
1015113400
9
Settlement Conversion Rate
FIXED
n
8
00000000
10
Cardholder Billing Conversion Rate
FIXED
n
8
00000000
11
System Trace Audit Number
FIXED
n
6
153401
12
Local Transaction Time
FIXED
n
6
113400
13
Local Transaction Date
FIXED
n
4
1015
14
Expiration Date
FIXED
n
4
3209
18
Merchant's Type
FIXED
n
4
5999
22
Point of Service Entry Mode
FIXED
n
3
021
32
Acquiring Institution ID, Code
HLVAR
n
5-11
111111
35
Track-2 Data
HLVAR
z*
37
1000001111222234=3209
37
Retrieval Reference Number
FIXED
an
12
211015113400
39
Response Code
FIXED
an
2
00
41
Card Acceptor Terminal Id.
FIXED
ans
8
90001000
42
Card Acceptor Identification Code
FIXED
ans
15
999998999998998
43
Card Acceptor Name/Location
FIXED
ans
40
1 Gulshan Ave DHAKA BD
49
Transaction Currency Code
FIXED
n
3
050
50
Settlement Currency Code
FIXED
n
3
050
51
Cardholder Billing Currency Code
FIXED
n
3
050
102
Account Identification 1
HLVAR
ans
1111222231
103
Account Identification 2
HLVAR
ans
1231111222235
122
Additional Record Data
HLLVAR
ans
999
IBFT












The ISO 8583 Message will be like below (1987 version): 

Internet Banking fund Transfer

                                                                                                               
0200FEFC44012AE0E00000000000060000401610000011112222302800000000010000000000010000000000010000001015113400000000000000000015340111340010153209599902106111111211000001111222234=320921101511340000900010009999989999989981 Gulshan Ave DHAKA BD                  050050050101111222231131231111222235004IBFT


(here 16 is an extra indicator, it just idicate the 2nd field’s length is 16, actually (2, Primary Account Number) field is Variable length, its highest limit is 19, so it is not actually 19, so it indicate these think here)


Now, I will go details explanation of the above message,

The message has three parts
1)       Message Type Indicator
2)       Bitmap
3)       Data elements


1) Message Type Indicator


        0200

Message Type Indicator (MTI):
                                                MTI is a (n4 - 4 Digits Numeric Value) required for all ISO 8583 messages in order to identify the message class/type. Like 0200, 0210, 1200, 1210 etc.

0200    

0 = Version Number
      2 = Message Class: - Is it financial message?
      0 = Message sub-class/function: - Is it request message?
      0 = Transaction Originator


1)      Version Number

0xxx
ISO 8583:1987 version
1xxx
ISO 8583:1993 version
2xxx
ISO 8583:2003 version

      2) Message Class: - Is it financial message?

                 1    -         Authorization
                 2   -          Financial
                 3  -           Acquirer/ Issuer
                 4  -           Acquirer Reversal/Issuer Reversal
                 5  -            Reconciliation Request Messages
                 6 -             Administrative Request Messages
                 8 -             Network Management Request


3)  Message sub-class/function: - Is it request message?
            0          -     Request
            1         -      Response
            2        -       Advice
            3       -        Advice Response

4)      Transaction Originator

Transaction Originator
Description
0
Acquirer
1
Acquirer repeat
2
Card issuer
3
Card issuer repeat
4
Other
5
Other repeat
6 - 9
Reserved for ISO use

By knowing the MTI value we can identify the type of message.

For Example:

If MTI value is 0200,  then from the table above we can find other details.

  • First position is for Version Number and value in MTI is 0, so message version is based on ISO 8583:1987 (1 is for ISO 8583:1993)
  • Second Position is for Message Class and value in MTI is 2, so message is a financial message.
  • Third position is for message sub-class/function and the value in MTI is 0, so the given message is a request message.
  • Fourth position is for Transaction Originator and value in MTI is 0, so the message is coming from Acquirer.

Message Type can be one of the following values (this is a partial list):
MTI
Description
x100
Authorization Request
x101
Authorization Request Repeat
x102
Authorization completion confirmation
x103
Authorization completion confirmation repeat
x110
Authorization Response
x112
Authorization completion response
x120
Authorization Advice
x121
Authorization advice repeat
x122
Authorization advice completion confirmation
x123
Authorization advice completion confirmation Report
x130
Authorization Advice Response
x132
Authorization advice completion response
x200
Financial Request
x210
Financial Response
x220
Financial Advice
x230
Financial Advice Response
x300
Acquirer File Update Request
x302
Issuer File Update Request
x310
Acquirer File Update Response
x312
Issuer File Update Response
x320
Acquirer File Update Advice
x322
Issuer File Update Advice
x330
Acquirer File Update Advice Response
x332
Issuer File Update Advice Response
x400
Acquirer Reversal Request
x402
Issuer Reversal Request
x410
Acquirer Reversal Request Response
x412
Issuer Reversal Request Response
x420
Acquirer Reversal Advice
x422
Issuer Reversal Advice
x430
Acquirer Reversal Advice Response
x432
Issuer Reversal Advice Response
x5xx
Reconciliation Request Messages
x6xx
Administrative Request Messages
x800
Network Management Request
x810
Network Management Request Response



2) Bitmap


Hexadecimal value: - FEFC44012AE0E0000000000006000040 = 32

And The binary value of this hexa value like below

11111110111111000100010000000001001010101110000011100000000000000000000000000000000000000000000000000110000000000000000001000000 = 128

(here 1= Special meaning of first 1 it’s indicate the existence of secondary bitmap)

Within ISO 8583, a bitmap is a field or subfield within a message which indicates which other data elements or data element subfields may be present elsewhere in a message.
A message will contain at least one bitmap, called the Primary Bitmap which indicates which of Data Elements 1 to 64 are present. A secondary bitmap may also be present, generally as data element one and indicates which of data elements 65 to 128 are present. Similarly, a tertiary, or third, bitmap can be used to indicate the presence or absence of fields 129 to 192, although these data elements are rarely used.
A field is present only when the specific bit in the bitmap is true.
For example, binary = '1000 0010'
 which means fields 1 and 7 are present in the message and fields 2, 3, 4, 5, 6, and 8 are not present.
Now, just try to compare the binary with our message generation requirement (internet banking fund transfer).


3)  Data elements

10000011112222302800000000010000000000010000000000010000001015113400000000000000000015340111340010153209599902106111111211000001111222234=320921101511340000900010009999989999989981 Gulshan Ave DHAKA BD  050050050101111222231131231111222235004IBFT



Data Elements is the essence of the whole ISO message, contain information about the transaction (Pan or account number, date time or the transaction, transaction type, amount, customer id, etc).
Each data element have their on format, attribute and length.
Each data element number also have standard purpose, for example full list of

There are up to 128 data elements specified in the original ISO 8583:1987 standard, and up to 192 data elements in later releases.

ISO-defined data elements
Data element
Type
Usage
1
b 64
Bit map (b 128 if secondary is present and b 192 if tertiary is present)
2
n ..19
Primary account number (PAN)
3
n 6
Processing code
4
n 12
Amount, transaction
5
n 12
Amount, settlement
6
n 12
Amount, cardholder billing
7
n 10
Transmission date & time
8
n 8
Amount, cardholder billing fee
9
n 8
Conversion rate, settlement
10
n 8
Conversion rate, cardholder billing
11
n 6
Systems trace audit number
12
n 6
Time, local transaction (hhmmss)
13
n 4
Date, local transaction (MMDD)
14
n 4
Date, expiration
15
n 4
Date, settlement
16
n 4
Date, conversion
17
n 4
Date, capture
18
n 4
Merchant type
19
n 3
Acquiring institution country code
20
n 3
PAN extended, country code
21
n 3
Forwarding institution. country code
22
n 3
Point of service entry mode
23
n 3
Application PAN number
24
n 3
Function code (ISO 8583:1993)/Network International identifier (NII)
25
n 2
Point of service condition code
26
n 2
Point of service capture code
27
n 1
Authorizing identification response length
28
n 8
Amount, transaction fee
29
n 8
Amount, settlement fee
30
n 8
Amount, transaction processing fee
31
n 8
Amount, settlement processing fee
32
n ..11
Acquiring institution identification code
33
n ..11
Forwarding institution identification code
34
n ..28
Primary account number, extended
35
z ..37
Track 2 data
36
n ...104
Track 3 data
37
an 12
Retrieval reference number
38
an 6
Authorization identification response
39
an 2
Response code
40
an 3
Service restriction code
41
ans 16
Card acceptor terminal identification
42
ans 15
Card acceptor identification code
43
ans 40
Card acceptor name/location (1-23 address 24-36 city 37-38 state 39-40 country)
44
an ..25
Additional response data
45
an ..76
Track 1 data
46
an ...999
Additional data - ISO
47
an ...999
Additional data - national
48
an ...999
Additional data - private
49
an 3
Currency code, transaction
50
an 3
Currency code, settlement
51
an 3
Currency code, cardholder billing
52
b 64
Personal identification number data
53
n 18
Security related control information
54
an ...120
Additional amounts
55
ans ...999
Reserved ISO
56
ans ...999
Reserved ISO
57
ans ...999
Reserved national
58
ans ...999
Reserved national
59
ans ...999
Reserved for national use
60
an .7
Advice/reason code (private reserved)
61
ans ...999
Reserved private
62
ans ...999
Reserved private
63
ans ...999
Reserved private
64
b 16
Message authentication code (MAC)
65
b 64
*Bit indicator of tertiary bitmap only*, tertiary bitmap data follows secondary in message stream.
66
n 1
Settlement code
67
n 2
Extended payment code
68
n 3
Receiving institution country code
69
n 3
Settlement institution country code
70
n 3
Network management information code
71
n 4
Message number
72
ans ...999
Data record (ISO 8583:1993)/n 4 Message number, last(?)
73
n 6
Date, action
74
n 10
Credits, number
75
n 10
Credits, reversal number
76
n 10
Debits, number
77
n 10
Debits, reversal number
78
n 10
Transfer number
79
n 10
Transfer, reversal number
80
n 10
Inquiries number
81
n 10
Authorizations, number
82
n 12
Credits, processing fee amount
83
n 12
Credits, transaction fee amount
84
n 12
Debits, processing fee amount
85
n 12
Debits, transaction fee amount
86
n 15
Credits, amount
87
n 15
Credits, reversal amount
88
n 15
Debits, amount
89
n 15
Debits, reversal amount
90
n 42
Original data elements
91
an 1
File update code
92
n 2
File security code
93
n 5
Response indicator
94
an 7
Service indicator
95
an 42
Replacement amounts
96
an 8
Message security code
97
n 16
Amount, net settlement
98
ans 25
Payee
99
n ..11
Settlement institution identification code
100
n ..11
Receiving institution identification code
101
ans 17
File name
102
ans ..28
Account identification 1
103
ans ..28
Account identification 2
104
ans ...100
Transaction description
105
ans ...999
Reserved for ISO use
106
ans ...999
Reserved for ISO use
107
ans ...999
Reserved for ISO use
108
ans ...999
Reserved for ISO use
109
ans ...999
Reserved for ISO use
110
ans ...999
Reserved for ISO use
111
ans ...999
Reserved for ISO use
112
ans ...999
Reserved for national use
113
n ..11
Authorizing agent institution id code
114
ans ...999
Reserved for national use
115
ans ...999
Reserved for national use
116
ans ...999
Reserved for national use
117
ans ...999
Reserved for national use
118
ans ...999
Reserved for national use
119
ans ...999
Reserved for national use
120
ans ...999
Reserved for private use
121
ans ...999
Reserved for private use
122
ans ...999
Reserved for private use
123
ans ...999
Reserved for private use
124
ans ...255
Info text
125
ans ..50
Network management information
126
ans ...999
Issuer trace id
127
ans ...999
Reserved for private use
128
b 16
Message authentication code


Field Definition
Meaning
n6
Fixed length field of six digits
n.6
LVAR numeric field of up to 6 digits in length
a..11
LLVAR alpha field of up to 11 characters in length
b...999
LLLVAR binary field of up to 999 bytes in length


For details you can follow others links
 


Now the Solution:-

You can generate data(pack data) to ISO 8583 message format as well as you can unpack it by this java solution very easily.

1)      Download the Zip file. ( i will attach it later)
2)      Unzip it.
3)      Open the java project with your favorite IDE (like Net Beans )
4)      There are two class one for pack data as ISO another is Unpack data.
5)      Oh, an XML file (test) is there (in zip file) you have keep it in his place because it contain the ISO 8583’s (1987 versions) 128 DE/fields and its definitions.

plz feel free to drop question in the comment if you confused.

Thanks