Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Merchant QR Parser

A CLI tool for decoding and parsing EMVCo / DuitNow QR codes — extracts merchant details, currency, account info, and more from Malaysia National QR images.


Features

  • Decodes QR codes directly from image files
  • Parses the full EMVCo TLV (Tag-Length-Value) structure recursively
  • Resolves DuitNow sub-tags (merchant account, mobile number, ID type)
  • Supports multiple QR codes in a single image
  • Outputs as a human-readable table or structured JSON
  • Graceful error handling for missing files, unreadable images, and blank results

Requirements

  • Python 3.10+
  • opencv-python
  • pyzbar
  • Pillow
  • qreader

Install dependencies:

pip install -r requirements.txt

Linux users: pyzbar requires the native zbar library.

sudo apt install libzbar0

Usage

python3 main.py --image <path-to-qr.png> [--json]

Arguments

Argument Required Description
--image Yes Path to the QR code image file
--json No Output parsed result as JSON

Examples

Default table output:

python3 main.py --image qr.png

JSON output:

python3 main.py --image qr.png --json

Sample output:

--- QR Code 1 ---
Raw: 00020201021126440014A000000615...

  Payload format indicator: 01
  Point of initiation method: 12
  Merchant account info:
    Tag 00: A000000615000101
    Tag 06: 0***********3
    Tag 12: 8
  Merchant category code: 0000
  Transaction currency: 458 (MYR)
  Country code: MY
  Merchant name: R****************U
  Merchant city: MY
  CRC: 7E6D

EMVCo Tag Reference

Tag Field Notes
00 Payload format indicator Always 01 (EMVCo v1)
01 Point of initiation 11 = static, 12 = dynamic
26 Merchant account info DuitNow / PayNet sub-tags
52 Merchant category code ISO 18245 MCC
53 Transaction currency ISO 4217 (e.g. 458 = MYR)
54 Transaction amount Optional
58 Country code ISO 3166-1 alpha-2
59 Merchant name
60 Merchant city
62 Additional data Bill number, reference
63 CRC checksum CRC-16/CCITT integrity check

Project Structure

merchant-qr-parser/
├── main.py            # CLI entry point
├── requirements.txt   # Python dependencies
└── README.md

Supported QR Standards

Standard Status
EMVCo QR Code Specification
Malaysia DuitNow (PayNet)

License

MIT © @R4shSec

About

This script parse a normal Touch 'n Go (TNG) merchant QR code to text via raw output or a JSON.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors