下面是一個EMV標準的銀聯境外商戶QR Code:
00020101021215314798034400020344798034459990001520459995303344540155802HK5923BOCI – MBD – CUP – MPOS6009Hong Kong6260012020180821170500009798052020180821170500009799070899996101630434e6
EMV的規範是TLV的結構,Tag length value ,即EMV的標準就是 tag+length+value+tag+length+value+tag+length+value 這樣依次排列的方式,tag代表的含義要參考各自機構的文檔,例如銀聯的EMV商戶碼的tag含義,要參考《UPI QR Code Encoding Specification_Merchant Presented QRC》這份文檔,length代表這一個tag對內用的內容的長度,即Value的長度,value就是具體的值了。
以上面的EMV碼的前三組數據舉例:
000201:00是tag,含義參考接口文檔意思是Payload Format Indicator,02是長度,最後的01是內容,參考接口文檔裡描述:Valid value: “01”
010212:01是tag,含義參考接口文檔意思是Point of Initiation Method,02是長度,最後的12是內容,參考接口文檔裡描述:“11” = Static QRC,“12” = Dynamic QRC ,這裡12代表的是动态码。
15314798034400020344798034459990001:15是tag,含義是Merchant Account Information ,31是長度,最後31位是內容,參考接口文檔描述如下圖。
如果按這樣的方式將上述的EMV進行解析,就變成如下方式,用顏色來區分每一組數據
00020101021215314798034400020344798034459990001520459995303344540155802HK5923BOCI – MBD – CUP – MPOS6009Hong Kong6260012020180821170500009798052020180821170500009799070899996101630434e6
解析後是如下的內容:
Tag | Length | Content | Remark |
00 | 02 | 01 | Payload Format Indicator |
01 | 02 | 12 | Point of Initiation Method |
15 | 31 | 4798034400020344798034459990001 | Merchant Account Information |
52 | 04 | 5999 | Merchant Category Code |
53 | 03 | 344 | Transaction Currency |
54 | 01 | 5 | Transaction Amount |
58 | 02 | HK | Country Code |
59 | 23 | BOCI – MBD – CUP – MPOS | Merchant Name |
60 | 09 | Hong Kong | Merchant City |
62 | 60 | 012020180821170500009798052020180821170500009799070899996101 | Additional Data Field Template |
63 | 04 | 34e6 | Cyclic Redundancy Check (CRC) |