Skip to content

thư viện hỗ trợ mã QR để thanh toán thông qua NAPAS

License

Notifications You must be signed in to change notification settings

ducnpdev/vietqr

Repository files navigation

VietQR - Golang

Go Report Card GoDoc License: MIT Go Version

VietQR Logo

A powerful Golang library for generating VietQR codes for NAPAS payment integration

📋 Table of Contents

🌟 Overview

VietQR is a Golang library that simplifies the generation of QR codes for NAPAS payment integration in Vietnam. It provides a clean and efficient way to create payment QR codes that comply with the NAPAS VietQR standard.

✨ Features

  • 🚀 Simple and intuitive API
  • 💰 Support for all NAPAS VietQR payment fields
  • 🔒 Type-safe implementation
  • 📝 Comprehensive field validation
  • 🎯 QR code generation for various payment scenarios
  • 🔍 QR code parsing and validation
  • 📚 Well-documented code

📥 Installation

go get github.com/ducnpdev/vietqr

�� Quick Start

package main

import (
    "fmt"
    "github.com/ducnpdev/vietqr"
)

func main() {
    // Create a VietQR payment request
    qrRequest := vietqr.RequestGenerateViQR{
        MerchantAccountInformation: vietqr.MerchantAccountInformation{
            AccountNo: "999990335280715",
        },
        TransactionAmount: "505000",
        AdditionalDataFieldTemplate: vietqr.AdditionalDataFieldTemplate{
            Description: "Payment for services",
        },
        Mcc:          "5139",
        ReceiverName: "Company ABC",
    }

    // Generate the VietQR code
    qrContent := vietqr.GenerateViQR(qrRequest)
    fmt.Println("Generated VietQR Content:", qrContent)
}

📖 Usage Examples

Basic Payment QR

qrRequest := vietqr.RequestGenerateViQR{
    MerchantAccountInformation: vietqr.MerchantAccountInformation{
        AccountNo: "999990335280715",
    },
    TransactionAmount: "100000",
    AdditionalDataFieldTemplate: vietqr.AdditionalDataFieldTemplate{
        Description: "Basic payment",
    },
    Mcc:          "5139",
    ReceiverName: "Merchant Name",
}

QR with Additional Data

qrRequest := vietqr.RequestGenerateViQR{
    MerchantAccountInformation: vietqr.MerchantAccountInformation{
        AccountNo: "999990335280715",
    },
    TransactionAmount: "200000",
    AdditionalDataFieldTemplate: vietqr.AdditionalDataFieldTemplate{
        Description: "Detailed payment information",
        // Add more fields as needed
    },
    Mcc:          "5139",
    ReceiverName: "Merchant Name",
}

🔍 QR Code Structure

The VietQR code follows the NAPAS standard structure. Here's an example of the QR code field breakdown:

  • golang vietqr detech qr.
0002
    01
0102
    12
3859
    0010
        A000000727
    0129
        0006
            970437
        0115
            999990335280715
        0208
            QRIBFTTA
5204
    5139
5303
    704
5406
    50500
5802
    VN
6217
    0813
        test noi dung
5907
    Cty ABC
6304
    33C4

�� Documentation

For detailed documentation about the VietQR standard, please refer to the official NAPAS documentation:

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some 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 ❤️ by ducnpdev

About

thư viện hỗ trợ mã QR để thanh toán thông qua NAPAS

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages