Writing a
SGQR Parser

 


Mon 10 Dec 2018
What is SGQR?



Credits: https://blog.seedly.sg/singapore-cashless-favepay-grabpay-paynow-paylah-alipay-nets/


Credits: https://www.channelnewsasia.com/news/singapore/sgqr-qr-code-cashless-payment-singapore-rolls-out-unified-10727568


Credits: https://www.mas.gov.sg/sgqr
SGQR Specifications
EMV QR Code Specification for Payment Systems:
Merchant-Presented Mode

https://www.emvco.com/emv-technologies/qrcodes/
Sample SGQR
00020101021126810011SG.COM.NETS01231198500065G9912312359000211111686614000308686614019908604108C251800007SG.SGQR01121809072DD85C020701.00010306079027040201050206060400000708201809155204581253037025802SG5912ABC MERCHANT6009Singapore630457B3
Data Objects

Each data object has 3 fields:
  • The ID is coded as a two-digit numeric value, with a value ranging from "00" to "99".
  • The length is coded as a two-digit numeric value, with a value ranging from "01" to "99".
  • The value field has a minimum length of one character and maximum length of 99 characters.
00020101021126810011SG.COM.NETS01231198500065G9912312359000211111686614000308686614019908604108C251800007SG.SGQR01121809072DD85C020701.00010306079027040201050206060400000708201809155204581253037025802SG5912ABC MERCHANT6009Singapore630457B3

000201 => 00 02 01 (ID: 00, Length: 02, Value: 01)

630457B3 => 63 04 57B3 (ID: 63, Length: 04, Value: 57B3)
...26810011SG.COM.NETS01231198500065G9912312359000211111686614000308686614019908604108C2...

ID: 26 (under Root Data Object) - Merchant Account Information Template, Length: 81

0011SG.COM.NETS => 00 11 SG.COM.NETS
ID: 00 (under Template for ID 26) - Globally Unique Identifier
Length: 11, Value: SG.COM.NETS
Parser Code
https://github.com/zionsg/sgqr-parser
Demo
https://intzone.com/tools/sgqr


Credits: https://www.channelnewsasia.com/news/singapore/sgqr-qr-code-cashless-payment-singapore-rolls-out-unified-10727568



PayNow SGQR sample

(with transaction amount and nested template id 50 under root template id 62)