Skip to content

A comprehensive Dart ecosystem for VietQR (Vietnamese QR Payment Standard) - EMVCo compliant QR code generation, rendering, and image export.

Notifications You must be signed in to change notification settings

vanvixi/vietqr.dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

70 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

VietQR.dart

Star on Github License: MIT Platform

A comprehensive Dart ecosystem for VietQR (Vietnamese QR Payment Standard) - EMVCo compliant QR code generation, rendering, and image export.

πŸš€ Quick Start

Choose the package that fits your needs:

dependencies:
  vietqr_widget: ^0.1.1    # Flutter UI widgets
  vietqr_image: ^0.1.0     # Image generation  
  vietqr_core: ^0.2.3      # Core encoding/decoding

πŸ“¦ Packages Overview

This monorepo contains three complementary packages that work together to provide a complete VietQR solution:

🧠 vietqr_core

Pub Version

The foundation - Pure Dart library for VietQR data encoding and decoding.

  • βœ… Pure Dart - Works everywhere (Flutter, web, server, CLI)
  • βœ… 18+ Vietnamese banks - Built-in support for major banks
  • βœ… EMVCo compliant - Follows international standards
  • βœ… Type-safe - Strong typing with validation
  • βœ… Encode & Decode - Full bidirectional support
import 'package:vietqr_core/vietqr_core.dart';

final payment = VietQrData(
  bankBinCode: SupportedBank.vietcombank,
  bankAccount: '0123456789',
  amount: '50000',
  merchantName: 'Coffee Shop',
);

final qrString = VietQr.encode(payment);

🎨 vietqr_widget

Pub Version

For Flutter apps - Beautiful, customizable QR code widgets.

  • βœ… Easy Integration - Drop-in Flutter widget
  • βœ… Customizable - Colors, embedded images, error handling
  • βœ… Responsive - Adapts to different screen sizes
  • βœ… Built-in validation - Automatic error handling
import 'package:vietqr_widget/vietqr_widget.dart';

VietQrWidget(
  data: payment,
  embeddedImage: EmbeddedImage(
    image: AssetImage('assets/logo.png'),
  ),
)

πŸ–ΌοΈ vietqr_image

Pub Version

For image generation - Export QR codes as PNG, JPEG, or other formats.

  • βœ… Multiple formats - PNG, JPEG, WebP support
  • βœ… Server-side - Perfect for backend services
  • βœ… Customizable - Size, colors, error correction
  • βœ… Memory efficient - Optimized for batch processing
import 'package:vietqr_image/vietqr_image.dart';

final imageBytes = await VietQrImage.generatePng(
  data: payment,
  size: 512,
);

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   vietqr_widget β”‚    β”‚   vietqr_image  β”‚    β”‚     Your App    β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚  Flutter UI     β”‚    β”‚  Image Export   β”‚    β”‚   Custom Logic  β”‚
β”‚  Components     β”‚    β”‚  PNG/JPEG/etc   β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                      β”‚                      β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚
                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                   β”‚       vietqr_core       β”‚
                   β”‚                         β”‚
                   β”‚  β€’ VietQR Encoding      β”‚
                   β”‚  β€’ VietQR Decoding      β”‚
                   β”‚  β€’ Bank Support         β”‚
                   β”‚  β€’ Data Validation      β”‚
                   β”‚  β€’ EMVCo Compliance     β”‚
                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🏦 Supported Banks

All packages support 18+ major Vietnamese banks including:

Bank BIN Code Bank BIN Code
Vietcombank 970436 MB Bank 970422
Vietinbank 970415 ACB 970416
BIDV 970418 VPBank 970432
Agribank 970405 Sacombank 970403
Techcombank 970407 TPBank 970423

View all supported banks β†’

🌟 Use Cases

πŸͺ E-commerce & Retail

// Dynamic QR for product checkout
final productPayment = VietQrData(
  bankBinCode: SupportedBank.techcombank,
  bankAccount: 'STORE123456',
  merchantName: 'Online Store',
  additional: AdditionalData(
    purpose: 'Product purchase',
    referenceLabel: 'ORDER-${orderId}',
  ),
);

πŸ• Restaurants & Food Service

// Table-specific QR codes
final tablePayment = VietQrData(
  bankBinCode: SupportedBank.vietcombank,
  bankAccount: '0123456789',
  merchantName: 'Pho Restaurant',
  additional: AdditionalData(
    purpose: 'Table payment',
    storeLabel: 'Table ${tableNumber}',
  ),
);

πŸ’Ό Business Invoicing

// Invoice payment QR
final invoicePayment = VietQrData(
  bankBinCode: SupportedBank.bidv,
  bankAccount: 'COMPANY789',
  amount: '1500000',
  merchantName: 'ABC Company Ltd',
  additional: AdditionalData(
    purpose: 'Invoice payment',
    billNumber: 'INV-2024-001',
    customerLabel: 'Client XYZ',
  ),
);

🎫 Event & Ticketing

// Event ticket payment
final ticketPayment = VietQrData(
  bankBinCode: SupportedBank.mbbank,
  bankAccount: 'EVENT456789',
  amount: '299000',
  merchantName: 'Concert Venue',
  additional: AdditionalData(
    purpose: 'Concert ticket',
    referenceLabel: 'TICKET-${ticketId}',
  ),
);

πŸ”§ Development

This project uses Melos for monorepo management.

# Install Melos
dart pub global activate melos

# Bootstrap the workspace
melos bootstrap

# Run tests for all packages
melos test

# Publish all packages
melos publish

Package Commands

# Core package
cd packages/vietqr_core
dart test

# Widget package  
cd packages/vietqr_widget
flutter test

# Image package
cd packages/vietqr_image
dart test

πŸ“š Documentation

Technical References

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Made with ❀️ for the Vietnamese developer community

If you find this project helpful, please give it a ⭐ on GitHub!

About

A comprehensive Dart ecosystem for VietQR (Vietnamese QR Payment Standard) - EMVCo compliant QR code generation, rendering, and image export.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published