This document provides a comprehensive technical breakdown of the EMVCo Merchant-Presented QR Code Specification as adapted by the National Payment Corporation of Vietnam (NAPAS) for the NAPAS 247 Quick Transfer ecosystem (VietQR).
VietQR utilizes the EMVCo QR Code Specification for Payment Systems (Merchant-Presented Mode). The payload is encoded as a continuous string of Tag-Length-Value (TLV) data objects:
[Tag: 2 digits][Length: 2 digits][Value: variable string]
00 to 99).01 to 99).63 (Length 04) containing a CRC16-CCITT checksum over all preceding characters including 6304.| Tag | Name | Type | Mandatory/Optional | Description |
|---|---|---|---|---|
| 00 | Payload Format Indicator | String (2) | Mandatory | Always 01 (indicates EMVCo QR Code version 1.0). |
| 01 | Point of Initiation Method | String (2) | Mandatory | 11 = Static QR (can be used for multiple transactions), 12 = Dynamic QR (specific to a single transaction with predefined amount). |
| 38 | Merchant Account Information | Sub-TLV | Mandatory | Contains NAPAS 247 banking routing information. |
| 53 | Transaction Currency Code | String (3) | Mandatory | ISO 4217 numeric currency code: 704 for Vietnamese Dong (VND). |
| 54 | Transaction Amount | Numeric String | Optional | Transaction amount (e.g., 50000, 100000). Omitted in static open-amount QRs. |
| 58 | Country Code | String (2) | Mandatory | ISO 3166-1 alpha-2 country code: VN for Vietnam. |
| 59 | Merchant / Beneficiary Name | String | Optional | Unaccented Latin name of beneficiary (e.g., NGUYEN VAN A). |
| 60 | Merchant City | String | Optional | City or location (e.g., HANOI, HCM). |
| 62 | Additional Data Field Template | Sub-TLV | Optional | Contains transaction memo, bill number, reference label, etc. |
| 63 | CRC16 Checksum | Hex (4) | Mandatory | 4-character uppercase hexadecimal CRC16-CCITT checksum. |
Tag 38 is a composite TLV containing sub-tags that identify the receiving bank, account/card number, and transfer service code:
38 [Len]
00 10 A000000727 (NAPAS Globally Unique Identifier / GUID)
01 [Len]
00 06 [Bank BIN] (6-digit NAPAS Bank Identifier)
01 [Len] [Account/Card Number](Bank Account or Card Number)
02 08 [Service Code] (QRIBFTTA or QRIBFTTC)
| Sub-Tag | Name | Content / Format | Description |
|---|---|---|---|
| 00 | Globally Unique Identifier (GUID) | A000000727 (Length 10) |
NAPAS Registered Application Identifier (AID). |
| 01 | Payment Network Specific (Beneficiary) | Composite Sub-TLV: | |
| ↳ 00 | Bank BIN Code | 6 digits (e.g., 970422 MB, 970436 VCB) |
NAPAS Acquiring Bank BIN code. |
| ↳ 01 | Account or Card Number | Alphanumeric (up to 19 characters) | Recipient’s bank account or card number. |
| 02 | Service Code | 8 characters: QRIBFTTA or QRIBFTTC |
• QRIBFTTA: Quick Transfer to Bank Account• QRIBFTTC: Quick Transfer to Card Number |
Tag 62 encodes contextual metadata about the payment:
| Sub-Tag | Name | Description | Example |
|---|---|---|---|
| 01 | Bill Number | Invoice or invoice identifier | INV-2025-001 |
| 02 | Mobile Number | Customer phone number | 0901234567 |
| 03 | Store Label | Branch or physical store ID | STORE01 |
| 05 | Reference Label | Reference code for automated reconciliation | REF889911 |
| 07 | Terminal Label | POS or counter terminal identifier | POS-01 |
| 08 | Purpose / Memo | Transaction description displayed in banking apps | Thanh toan don hang #1042 |
EMVCo mandates the CRC16-CCITT-FALSE algorithm:
0x1021 ($x^{16} + x^{12} + x^5 + 1$)0xFFFFfalsefalse0x00000002010102123854...62180814DON HANG 1042
6304 to the payload string:
0002010102123854...62180814DON HANG 10426304
7B9F).0002010102123854...62180814DON HANG 104263047B9F
pub fn crc16_ccitt(data: &str) -> String {
let mut crc: u16 = 0xFFFF;
for byte in data.bytes() {
crc ^= (byte as u16) << 8;
for _ in 0..8 {
if (crc & 0x8000) != 0 {
crc = (crc << 1) ^ 0x1021;
} else {
crc <<= 1;
}
}
}
format!("{:04X}", crc)
}
To parse and validate an arbitrary VietQR payload:
000201 + 6304xxxx).expected_crc.expected_crc (case-insensitive).L (2 chars).L chars).38, recursively parse Sub-Tags 00, 01 (and its sub-tags 00 and 01), and 02.62, recursively parse Sub-Tags 01 through 08.54, parse numeric amount.59, extract beneficiary name.