A quick guide on how SGQR code works.

Victor Liew
4 min readMar 3, 2023

The SGQR adopts the EMVCO QR code standards, and hence all discussions in this article are to be taken with the below reference in mind.

What is SGQR?

It is a single standardised QR code for e-payments and combines multiple payment schemes into a single SGQR label. Consumers just need to look out for the SGQR label to see which payment options a merchant accepts, while merchants only need to display one SGQR label instead of many labels. The SGQR scheme is co-owned by MAS and IMDA.

How does it work?

Suppose you have the following SGQR code:

and if you scan the code, you would get an output like this:

00020101021102164761360000000*1704155123456789123451110123456789012153123456789012341531250003440001034450003445311000126330015SG.COM.DASH.WWW0110000005550127670014A00000076200010120COM.LQDPALLIANCE.WWW021512345678901234503020028660011SG.COM.OCBC0147OCBCP2P629A358D-ECE7-4554-AD56-EBD12D84CA7E4F7329500006SG.EZI013603600006-76bb-4a5a-aa1a-fbcb64d6ecf530850013SG.COM.EZLINK01201234567890123456-1230204SGQR0324A123456,B123456,C12345670404A23X31260008COM.GRAB0110A93FO3230Q32390007COM.DBS011012345678900210123456789033900011SG.COM.NETS01230201401832831128823590002150001118703240000308885872010901199084E5DC3D834430017COM.QQ.WEIXIN.PAY011012345678900204123435660010SG.COM.UOB014845D233507F5E8C306E3871A4E9FACA601A80C114B5645E5D36940009SG.PAYNOW010100216+6212345678901230301004351234567890123456789012345678901234505082020123137270009SG.AIRPAY0110A11BC0000X51860007SG.SGQR0112180307510317020701.0003030608100604020205031380609Counter010708201804075204581453037025802SG5916FOOD XYZ PTE LTD6009SINGAPORE6106081006622301081234567R060787654306304317F

So what exactly do these bunch of random numbers represent?

It represents a series of data objects which is made up of three individual fields. The first field is an identifier (ID) by which the data object can be referenced. The next field is a length field that explicitly indicates the number of characters included in the third field: the value field. A data object is then represented as an ID / Length / Value combination, where:  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 a maximum length of 99 characters.

So in the above example:

The first 6 chars 000201 define the following: Payload Format Indicator, the first 2 chars is the ID number, followed by a 02 which indicates the length of the data field, and in this case, the data field is 01, of length 2

The next 6 chars 010211 defines the following: Point of Initiation Method. The first 2 chars are the ID number, followed by a 02 which indicates the length of the data field, in this case, the data field is 11 (which represents a static QR code) of length 2

The next 20 chars 02164761360000000*17 has the first 2 character 02 defining the merchant ID as per the below table, and next 2 character of 16 indicating 16 characters as the merchant information.

The next data object is 0415512345678912345 which represents Mastercard

This goes on all the way till

36940009SG.PAYNOW010100216+62123456789012303010043512345678901234567890123456789012345050820201231

which represents the following:

and the last payment provider 37270009SG.AIRPAY0110A11BC0000X which represents:

Finally after listing out all of the payment schemes we now have information about the merchant:

51860007SG.SGQR0112180307510317020701.0003030608100604020205031380609Counter01070820180407

5204581453037025802SG5916FOOD XYZ PTE LTD6009SINGAPORE6106081006 which represents more details on the merchant

622301081234567R06078765430 which represents the bill number and customer reference code

and finally ending with 6304317F as a checksum to ensure that the QR data code is not malformed.

Hence by knowing the above encoding structure, various wallet providers are able to extract a payment scheme that they support and use the data provided to initiate payment.

What’s interesting would be to embed and return a blockchain address that is supported by a wallet provider ( or in fact anyone in the world with a crypto wallet ) to make payments : -)

[1] https://github.com/payfazz/EMVCo-SGQR-encode-decode-crc/blob/master/src/main/java/com/hisen/emvco/docs/SGQR%C2%A0Specifications%C2%A0v1.7.pdf

[2] https://github.com/payfazz/EMVCo-SGQR-encode-decode-crc/blob/master/src/main/java/com/hisen/emvco/docs/EMVCo-Merchant-Presented-QR-Specification-v1-1.pdf

--

--