Introduction
What is ISO8583
ISO8583open in new window is an international standard for financial transaction card originated interchange messaging. It is the International Organization for Standardization standard for systems that exchange electronic transactions initiated by cardholders using payment cards.
ISO8583 Structure
ISO8583 structure is used in Thailand consists of
- Length of Message (2 Bytes)
- TPDU header is
60(1 Byte) - Destination Address (2 Bytes)
- Originator Address (2 Bytes)
- Message Type (2 Bytes)
- Bitmap (8 or 16 Bytes)
- Data (N Bytes)
Request Message
| Size (hex) | TPDU | Destination Address | Originator Address | Message Type | Bitmap | Data |
|---|---|---|---|---|---|---|
| 2 Bytes | 1 Byte | 2 Bytes | 2 Bytes | 2 Bytes | 8 or 16 Bytes | N Bytes |
Response Message
| Size (hex) | TPDU | Originator Address | Destination Address | Message Type | Bitmap | Data |
|---|---|---|---|---|---|---|
| 2 Bytes | 1 Byte | 2 Bytes | 2 Bytes | 2 Bytes | 8 or 16 Bytes | N Bytes |
ISO8583 Example
[Original Message]
0090600120800002003020058020C800040030000000000010000050740022012000375500000000000001D12112012400403360400F 31313131313131313131313131313131313131313131316042353530313330303037393334383337385E535550415649542050414E594146414E475E3232313132303130303030303030303630343030303030300006303030323337
[Extract Message]
[TPDU] 6001208000
[MSG_TYPE] 0200
[BITMAP] 3020058020C80004
[DE003] 003000
[DE004] 000000001000
[DE011] 005074
[DE022] 0022
[DE024] 0120
[DE025] 00
[DE035] 375500000000000001D12112012400403360400F
[DE041] 3131313131313131
[DE042] 313131313131313131313131313131
[DE045] 6042353530313330303037393334383337385E535550415649542050414E594146414E475E323231313230313030303030303030363034303030303030
[DE062] 0006303030323337
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ISO8583 Message Type
Message Type is type of transaction for tell to host know type of transaction request with the details to follow
The first and second digits identify the class of message
| Code | Meaning |
|---|---|
| 01 | Authorization message |
| 02 | Financial transaction message |
| 03 | File Update/Transfer message |
| 04 | Reversal message |
| 05 | Reconciliation control message |
| 06 | Administrative message |
| 08 | Network management message |
The third and fourth digit identify the message function and transmission mode
| Code | Meaning |
|---|---|
| 00 | Interactive request |
| 10 | Interactive request response |
| 20 | Non-Interactive advice |
| 30 | Non-Interactive advice response |
| 40 | Notification |
01xx - Authorization message
| Code | Meaning |
|---|---|
| 0100 | Authorization request |
| 0110 | Authorization response |
| 0120 | Authorization advice |
| 0130 | Authorization advice response |
02xx -Financial transaction message
| Code | Meaning |
|---|---|
| 0200 | Financial transaction request |
| 0210 | Financial transaction response |
| 0220 | Financial transaction advice |
| 0230 | Financial transaction advice response |
03xx - File Update/Transfer message
| Code | Meaning |
|---|---|
| 0320 | File Update/Transfer advice |
| 0330 | File Update/Transfer response |
04xx - Reversal message
| Code | Meaning |
|---|---|
| 0400 | Reversal request |
| 0410 | Reversal response |
05xx - Reconciliation message
| Code | Meaning |
|---|---|
| 0500 | Card acceptor reconciliation request |
| 0510 | Card acceptor reconciliation response |
08xx - Network management message
| Code | Meaning |
|---|---|
| 0800 | Network management request |
| 0810 | Network management response |
Bitmap
Bitmap is HEX value to tell data enabled position to can read value at that element position.
How to caluculate bitmap value
- You must know data elements want to use (DE 1 - 64)
- If you know data element want to use. You have to fill out a data in format of binary (0, 1) total 64 bits
- Then convert from Binary to Heximal
Example
Bitmap to want
- HEX :
3020058020C80004 - Decimal:
3,4,11,22,24,25,35,41,42,45,62
- Initial binary
64 bits.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 | 0000 |
- Replace
1on0according substitute the set values of Decimal at position 1 - 64.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0011 | 0000 | 0010 | 0000 | 0000 | 0101 | 1000 | 0000 | 0010 | 0000 | 1100 | 1000 | 0000 | 0000 | 0000 | 0100 |
In the example substitute the set values and get 0011 0000 0010 0000 0000 0101 1000 0000 0010 0000 1100 1000 0000 0000 0000 0100
- Convert Binary to Heximal.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | 0 | 2 | 0 | 0 | 5 | 8 | 0 | 2 | 0 | C | 8 | 0 | 0 | 0 | 4 |
In the example substitute the set values and get 3020058020C80004
private fun getBitmap(bitmapData: ArrayList<Int>): String? {
// Create array list of Int type size of 64
val bitmap = MutableList<Int?>(64) { 0 }
// Loop bitmapData
bitmapData.forEach {
// Add 1 in bitmap element position
bitmap[it - 1] = 1
}
// Join array list to string and change binary to HEX string
return utils.binaryToHex(bitmap.joinToString(""))
}
2
3
4
5
6
7
8
9
10
11