IPP API basics
myPOS Integrated Payment Protocol (IPP) is responsible for the communication between the caller and the terminal. The format of the protocol is two bytes header followed by [Property]=[Value] sequence. The caller must specify in the header the total length of the message. Having that information the POS reads as bytes as they are pointed in the header and that is considered to be the end of the message. Please refer to the example below.
Every property/value pair is terminated with Carriage return and Line feed (CRLF) characters (“\r\n” - C; 0x0D, 0x0A - Hexadecimal). White-spaces are not allowed (e.g. no extra tabs and spaces are managed). The IPP parser currently set Property as any text before the ‘=’ character and Value as any text after the ‘=’ character. Property names are case sensitive, all capital characters must be used.
PROTOCOL=IPP always should be in the first row. METHOD always should be at the second row. DATA/where applicable/ must be in the last row. The other pairs are order insensitive.
Example when POS receives data
PROTOCOL=IPP\r\n
VERSION=200\r\n
METHOD=INIT\r\n
SID=f260883b-512b-446f-9b3c-d66e1f52bebd\r\n
STAGE=1\r\n
STATUS=0\r\n
In byte HEX notation:
50 52 4f 54 4f 43 4f 4c 3d 49 50 50 0d 0a
56 45 52 53 49 4f 4e 3d 32 30 30 0d 0a
4d 45 54 48 4f 44 3d 49 4e 49 54 0d 0a
53 49 44 3d 66 32 36 30 38 38 33 62 2d 35 31 32 62 2d 34 34 36 66 2d 39 62 33 63 2d 64 36 36 65 31 66 35 32 62 65 62 64 0d 0a
53 54 41 47 45 3d 31 0d 0a
53 54 41 54 55 53 3d 30 0d 0a
MESSAGE LENGTH: 101 (65 in HEX)
HEADER (IN HEX): 0x00 0x67
TOTAL LENGTH: 103(67 in HEX)
TOTAL MESSAGE |
0x00 0x67 0x50 0x52 0x4f 0x54 0x4f 0x43 0x4f 0x4c 0x3d 0x49 0x50 0x50….. |
Example when POS sends data
PROTOCOL=IPP\r\n
VERSION=200\r\n
METHOD=PROCESS\r\n
STAGE=4\r\n
STATUS=32\r\n
SID=f260883b-512b-446f-9b3c-d66e1f52bebd\r\n
TIMEOUT=0\r\n
IP=pos1.mypos.com\r\n
PORT=3012\r\n
CHAIN=Binary data\r\n
DATA=Binary data\r\n
In byte HEX notation:
50 52 4f 54 4f 43 4f 4c 3d 49 50 50 0d 0a
56 45 52 53 49 4f 4e 3d 32 30 30 0d 0a
4d 45 54 48 4f 44 3d 50 52 4f 43 45 53 530d 0a
53 54 41 47 45 3d 34 0d 0a
53 54 41 54 55 53 3d 33 32 0d 0a
53 49 44 3d 66 32 36 30 38 38 33 62 2d 35 31 32 62 2d 34 34 36 66 2d 39 62 33 63 2d 64 36 36 65 31 66 35 32 62 65 62 64 0d 0a
54 49 4d 45 4f 55 54 3d 30 0d 0a
49 50 3d 70 6f 73 31 2e 6d 79 70 6f 73 2e 63 6f 6d 0d 0a50 4f 52 54 3d 33 30 31 32 0d 0a
43 48 41 49 4e 3d 0d 0a
44 41 54 41 3d 0d 0a
MESSAGE LENGTH: 161 (A1 in HEX)
HEADER (IN HEX): 0x00 0xAD
TOTAL LENGTH: 163(A3 in HEX)
TOTAL MESSAGE |
0x00 0xА3 0x50 0x52 0x4f 0x54 0x4f 0x43 0x4f 0x4c 0x3d 0x49 0x50 0x50….. |