VietQR EMVCo Generator & Parser for Python
A lightweight, zero-dependency Python library to generate and parse VietQR codes conforming to the EMVCo standard spec (used by Napas for Vietnam banking QR codes).
Installation
Install using pip:
pip install vietqr-emvco
Features
- No external dependencies: Only uses standard Python libraries.
- Generator: Generate standard EMVCo-compliant VietQR strings with dynamic amount, memo, and beneficiary details. Includes automatic bank BIN resolution for popular Vietnamese banks.
- Parser: Decompose a raw VietQR string into structured tags (Acquirer BIN, Account Number, Amount, Currency, Country, Merchant Name, Transaction Memo).
- CRC16 Checker: Verify whether a VietQR string has a valid checksum.
Quick Start
1. Generate VietQR
from vietqr_emvco import VietQRGenerator
# Initialize with Bank name (MBBank, Vietcombank, etc.) or 6-digit Acquirer BIN
vietqr = VietQRGenerator(bank="MBBank", account="12345678900")
# Generate standard EMVCo text
qr_text = vietqr.generate(
amount=100000,
memo="ITBLOG PAY 123",
merchant_name="NGUYEN VAN A"
)
print("Raw EMVCo string:", qr_text)
# Generate image URL using VietQR.io template
image_url = vietqr.generate_image_url(
amount=100000,
memo="ITBLOG PAY 123",
merchant_name="NGUYEN VAN A"
)
print("Image URL:", image_url)
2. Parse VietQR
from vietqr_emvco import VietQRParser
qr_text = "00020101021238540010A00000072701240006970422011012345678900208QRIBFTTA52040000530370454061000005802VN5912NGUYEN VAN A62180810ITBLOG PAY16304E85C"
# Verify CRC16 checksum
is_valid = VietQRParser.verify_checksum(qr_text)
print("Checksum valid:", is_valid)
# Parse to structured data
details = VietQRParser.parse(qr_text)
print("Bank BIN:", details["bank_bin"])
print("Account Number:", details["account_number"])
print("Amount:", details["amount"])
print("Memo:", details["memo"])
print("Merchant Name:", details["merchant_name"])
List of Supported Bank Aliases
You can pass the following aliases to VietQRGenerator(bank=...):
MBBank(BIN:970422)Vietcombank(BIN:970436)Techcombank(BIN:970407)BIDV(BIN:970418)Vietinbank(BIN:970415)VPBank(BIN:970432)TPBank(BIN:970423)ACB(BIN:970416)Sacombank(BIN:970403)HDBank(BIN:970437)- ... or any 6-digit BIN code directly.
License
MIT License.
Metadata
Release files for vietqr-emvco 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vietqr_emvco-1.0.0.tar.gz | 7.1 kB | Without provenance | Details for vietqr_emvco-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vietqr_emvco-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for vietqr_emvco-1.0.0-py3-none-any.whl |
Total release size: 14.7 kB
Release files / vietqr_emvco-1.0.0.tar.gz
| Download URL | vietqr_emvco-1.0.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06c23fefa3bc09277f3c3a243abb70fb7f8b135ef32baa9856754768972b759e
|
|
BLAKE2b-256 checksum How to use checksums |
69c5bb4c699e6524171d726b7f5b68b3443c0fbe4480a3f1dbbaee56b190995f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / vietqr_emvco-1.0.0-py3-none-any.whl
| Download URL | vietqr_emvco-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e082619ac1a00254e63f0dae84c30c9c5c25afc52ead086448b9588edc3ef527
|
|
BLAKE2b-256 checksum How to use checksums |
a3f8df46e4c652e317a264685b9951bc34dd595707291edbf7c12030370d9727
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Security for vietqr-emvco 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.