npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@kitmodule/kitnapas

v1.0.5

Published

Generate NAPAS EMV-QR payloads in vanilla JavaScript — lightweight, chainable, and dependency-free.

Readme

💳 KitNapas JS by Kitmodule

Generate NAPAS EMV-QR payloads in vanilla JavaScript — lightweight, chainable, and dependency-free.

English | Tiếng Việt

npm version license

✨ Features

  • 🏦 Generate NAPAS 247 (QRIBFTTA) QR payloads.
  • 🔗 Supports BIN, account number, amount, and add info.
  • ⚡ Pure vanilla JavaScript, zero dependencies.
  • 🧱 Fluent, chainable API.
  • 🔒 Built-in CRC16 checksum.

🚀 Installation

Using npm

npm install @kitmodule/kitnapas

Using CDN

<script src="https://unpkg.com/@kitmodule/kitnapas/dist/kitnapas.min.js"></script>

💡 Usage

Browser (CDN)

<script src="https://unpkg.com/@kitmodule/kitnapas/dist/kitnapas.min.js"></script>
<script>
const qr = new KitNapas("970436", "0651000837537")
  .amount("50000")
  .info("Nap tien NAPAS 247")
  .payload();

console.log(qr);
</script>

Node.js / ES Module

import { KitNapas } from "@kitmodule/kitnapas";

const qr = new KitNapas("970436", "0651000837537")
  .amount("50000")
  .info("Transfer to auth")
  .payload();

console.log(qr);

🧩 API Reference

kitmodule.napas(bin, accountNumber)

Create a new NAPAS QR generator instance.

| Param | Type | Description | | --------------- | -------- | --------------------------- | | bin | string | Bank BIN code (Acquirer ID) | | accountNumber | string | Account or consumer ID |

Chainable methods

| Method | Description | Example | | ---------------- | --------------------------------------------------------- | ------------------- | | .amount(value) | Set transaction amount | .amount("50000") | | .info(text) | Set additional info / purpose | .info("Nap tien") | | .country(code) | Set country code (default: "VN") | .country("VN") | | .dynamic() | Switch to dynamic QR (PointOfInitiationMethod = 12) | .dynamic() | | .payload() | Generate the final EMV-QR string | .payload() |

Exports Overview

| Export | Type | Description | | ------------------- | ---------- | --------------------------------------- | | kitmodule.Napas | class | Class constructor | | kitmodule.napas() | function | Factory shortcut returning new instance | | KitNapas (global) | class | Global reference for browsers |

🧪 Example Output

const payload = new KitNapas("970436", "0651000837537")
  .amount("50000")
  .info("Donate auth")
  .payload();

console.log(payload);

Output (example):

00020101021138560010A000000727011600069704150112345678900203QRIBFTTA53037045406500005802VN621008086E6170206304A13B

🧩 Integration with QRCode.js

Easily display the generated NAPAS payload as a scannable QR code using QRCode.js:

<!-- Include both libraries -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Hello, NAPAS QR!</title>
  <link rel="stylesheet" href="styles.css">
  <script src="https://unpkg.com/@kitmodule/kitnapas/dist/kitnapas.min.js"></script>
  <script src="https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs/qrcode.min.js"></script>
</head>
<body>
  <h1>NAPAS QR Code Demo</h1>
  <div id="qrcode"></div>

  <script>
    // Generate NAPAS payload
    const payload = new KitNapas("970436", "0651000837537")
      .amount("100000")
      .info("Donate auth KitNapas")
      .payload();

    console.log("Generated payload:", payload);

    // Render QR code on the page
    new QRCode(document.getElementById("qrcode"), {
      text: payload,
      width: 200,
      height: 200,
      colorDark: "#000000",
      colorLight: "#ffffff",
      correctLevel: QRCode.CorrectLevel.M
    });
  </script>
</body>
</html>

This will display a valid NAPAS 247 EMV-QR image ready for banking apps to scan.

🤝 Contributing

Contributions are welcome! Open an issue or submit a pull request at github.com/kitmodule/kitnapas.

☕ Support the Author

Ko-fi Buy Me a Coffee GitHub Sponsors Patreon PayPal

🧾 License

Released under the MIT License © 2025 Huỳnh Nhân Quốc · Open Source @Kit Module