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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@inverz/promptpay

v1.0.0

Published

Thai PromptPay and Bill Payment QR codes for React: EMVCo payload builder, parser and CRC check, React-free core for servers

Readme

@inverz/promptpay

สร้าง QR พร้อมเพย์ และ QR ชำระบิล (Bill Payment) ตามมาตรฐาน Thai QR Payment (EMVCo) สำหรับ React รับเงินเข้าเบอร์มือถือ เลขบัตรประชาชน / เลขผู้เสียภาษี หรือ e-Wallet กำหนดยอดหรือให้ผู้จ่ายกรอกเอง อ่านและตรวจ payload กลับได้ และสร้างรูป SVG ฝั่ง server โดยไม่ต้องมี React

ดูตัวอย่าง (Demo)

PromptPay and Bill Payment QR codes for React (Thai QR Payment / EMVCo), with a payload parser, CRC check and a React-free core for servers.

ติดตั้ง

npm i @inverz/promptpay
import "@inverz/promptpay/style.css"; // ไม่บังคับ
import { PromptPayQR, BillPaymentQR } from "@inverz/promptpay";

PromptPayQR

<PromptPayQR target="0812345678" amount={150} name="ร้านกาแฟใจดี" />
  • target รับเบอร์มือถือ (081-234-5678, +66 81 234 5678), เลขบัตรประชาชน / เลขผู้เสียภาษี 13 หลัก (ตรวจหลักสุดท้ายให้) หรือเลข e-Wallet 15 หลัก
  • ไม่ใส่ amount จะได้ QR ที่ใช้ซ้ำได้ ผู้จ่ายกรอกยอดเอง ใส่ amount จะได้ QR สำหรับยอดนั้น
  • ถ้าข้อมูลไม่ถูกต้อง จะแสดงกล่องแจ้งแทน QR และ onPayload ได้ null

| prop | ค่าเริ่มต้น | คำอธิบาย | |---|---|---| | target | | เบอร์มือถือ / เลข 13 หลัก / e-Wallet 15 หลัก | | amount | | ยอดเงิน (บาท) ตัวเลขหรือข้อความ เช่น "1,500.50" | | name | | ชื่อผู้รับหรือร้านที่แสดงใต้ QR | | showTarget | true | แสดงปลายทางแบบซ่อนเลข 081-xxx-5678 | | card | true | false แสดงเฉพาะตัว QR | | size | 220 | ขนาด QR (px) | | level | "M" | ระดับแก้ข้อผิดพลาด L M Q H | | locale | "th" | "en" ข้อความภาษาอังกฤษ | | onPayload | | (payload: string \| null) => void |

BillPaymentQR

ใช้เมื่อต้องรู้ว่าออเดอร์ไหนจ่ายแล้ว ธนาคารจะแจ้งกลับระบบพร้อม ref1 / ref2 ต้องสมัครบริการ Bill Payment กับธนาคารหรือผู้ให้บริการชำระเงินเพื่อได้ Biller ID ก่อน

<BillPaymentQR billerId="010556012345601" ref1="INV2026001" ref2="A1" amount={1500} />
  • billerId 15 หลัก
  • ref1 (บังคับ) และ ref2 ใช้ได้เฉพาะ A–Z และ 0–9 ไม่เกิน 20 ตัว ใช้ cleanRef(value) แปลงค่าที่ผู้ใช้พิมพ์ให้ตรงรูปแบบ

QRCode

สร้าง QR จากข้อความอะไรก็ได้ วาดเป็น SVG

<QRCode value="https://example.com" size={160} />

ฟังก์ชัน (ใช้ฝั่ง server ได้)

@inverz/promptpay/core ไม่ดึง React

import { promptPayPayload, billPaymentPayload, parsePayload, qrSvg } from "@inverz/promptpay/core";

const payload = promptPayPayload("0812345678", { amount: 250 });
const svg = qrSvg(payload, { size: 240 }); // "<svg …>" แนบในอีเมลหรือ PDF ได้

parsePayload(payload);
// { valid: true, type: "phone", target: "0812345678", amount: 250, reusable: false, … }

| ฟังก์ชัน | คำอธิบาย | |---|---| | promptPayPayload(target, { amount }) | payload พร้อมเพย์ ข้อมูลผิดจะ throw | | billPaymentPayload({ billerId, ref1, ref2, amount }) | payload ชำระบิล | | parsePayload(payload) | อ่านกลับ พร้อม valid จากการตรวจ CRC (ถ้ามีคนแก้ยอดหรือพิมพ์ผิดจะได้ false) | | promptPayType(target) | "phone" / "id" / "ewallet" / null | | isPromptPayTarget(target) | ใช้รับเงินพร้อมเพย์ได้ไหม | | maskTarget(target) | "081-xxx-5678" | | cleanRef(value) | แปลงเป็น ref ที่ Bill Payment รับได้ | | qrSvg(payload, { size, margin, level, color, background }) | รูป QR เป็นข้อความ SVG | | qrMatrix(payload), qrPath(matrix) | ข้อมูล QR สำหรับวาดเอง | | crc16(text), tlv(id, value) | ตัวช่วยระดับล่าง |

ข้อควรรู้

  • QR ที่สร้างเป็นการโอนเงินจริง ก่อนใช้งานจริงให้ลองสแกนด้วยแอปธนาคารที่ลูกค้าใช้บ่อย
  • แพ็กเกจนี้สร้าง QR อย่างเดียว ไม่ได้ตรวจว่าเงินเข้าแล้ว ถ้าต้องการยืนยันการจ่ายอัตโนมัติให้ใช้ Bill Payment กับบริการแจ้งเตือนของธนาคาร
  • QR มีพื้นขาวเสมอ แม้ในธีมมืด เพื่อให้ทุกแอปสแกนได้
  • ปรับสีกรอบด้วย CSS variables --tpp-brand, --tpp-surface, --tpp-border, --tpp-text, --tpp-radius

PromptPay และ Thai QR Payment เป็นเครื่องหมายของเจ้าของ แพ็กเกจนี้ไม่ได้เกี่ยวข้องกับธนาคารแห่งประเทศไทยหรือสมาคมธนาคารไทย

License

MIT © 2026 Inverz Solutions Co.,Ltd.

ใช้ qrcode-generator (MIT) วาด QR