04 · 2026
หารบิล + QR พร้อมเพย์Bill Splitter + PromptPay QR
หารค่าอาหารตามที่แต่ละคนกินจริง คิดค่าบริการและ VAT ให้ แล้วสร้าง QR พร้อมเพย์ยอดของแต่ละคน สแกนจ่ายได้ทุกธนาคารSplit a restaurant bill by who ate what, with service charge and VAT, then get a PromptPay QR with each person's exact amount.
// ใช้สตางค์ (จำนวนเต็ม) ตลอด แล้วแจกเศษให้ครบconst parts = allocate(cost, who.map(() => 1));// ส่วนลด → ค่าบริการ → VAT ของ (ยอด + ค่าบริการ)const service = round(afterDiscount * servicePct / 100);const vat = round((afterDiscount + service) * vatPct / 100);ปัญหา
ไปกินข้าวกับเพื่อน สั่งของไม่เท่ากัน บางจานกินด้วยกัน บางอย่างสั่งคนเดียว แล้วยังมีค่าบริการ 10% กับ VAT 7% — สุดท้ายคนจ่ายต้องมานั่งกดเครื่องคิดเลข แล้วส่งเลขบัญชีให้ทุกคน
ใช้ยังไง
- ใส่ชื่อคนที่ไป (พิมพ์หลายชื่อคั่นด้วย
,ได้) - ใส่รายการอาหาร แล้วกดชื่อคนที่กินรายการนั้น — ไม่เลือกใคร = หารทุกคน
- ใส่ค่าบริการ / VAT / ส่วนลด
- เลือกคนจ่ายและใส่เบอร์พร้อมเพย์ → ทุกคนได้ QR ที่มียอดของตัวเอง สแกนจ่ายได้ทันที
- กด "คัดลอกสรุป" ไปวางใน LINE หรือ "แชร์ลิงก์บิล" ให้เพื่อนเปิดดูรายละเอียดเอง
จุดที่ตั้งใจทำให้ถูกต้อง
- ยอดทุกคนรวมกันเท่ายอดบิลเป๊ะ — คำนวณเป็นสตางค์ (จำนวนเต็ม) แล้วแจกเศษด้วยวิธี largest remainder ไม่มีเศษ 0.01 หาย
- ลำดับการคิดแบบร้านอาหารไทย: ส่วนลด → ค่าบริการ → VAT ของ (ยอด + ค่าบริการ)
- ส่วนลด ค่าบริการ และ VAT แบ่งตามสัดส่วนที่แต่ละคนกิน ไม่ได้หารเท่า
- QR พร้อมเพย์สร้างเองตามมาตรฐาน EMVCo (TLV + CRC-16) มี test เทียบผลกับไลบรารี
promptpay-qrที่ใช้กันแพร่หลาย ทั้งเบอร์โทร เลขบัตร และ e-Wallet - ตรวจเลขบัตรประชาชนด้วย checksum ก่อนสร้าง QR
ความเป็นส่วนตัว
ทุกอย่างคำนวณในเบราว์เซอร์ ไม่มี server ลิงก์ที่แชร์เก็บข้อมูลบิลไว้ในส่วน # ของ URL (ไม่ถูกส่งไปที่ server ใดๆ)
The problem
Dinner with friends: everyone orders different things, some dishes are shared, and there's a 10% service charge plus 7% VAT. Whoever paid ends up on a calculator, then sends their bank number to everyone.
How to use it
- Add who came (comma-separate several names)
- Add each item and tap who shared it — nobody selected means everyone
- Set service charge / VAT / discount
- Pick who paid and enter their PromptPay number → everyone gets a QR with their own amount
- "Copy summary" for LINE, or "Share bill link" so friends can check the details themselves
Getting the maths right
- Shares always add up to the bill exactly — everything is in satang (integers) and remainders are handed out with the largest-remainder method, so no stray 0.01
- Thai restaurant order: discount → service charge → VAT on (food + service)
- Discount, service and VAT are split in proportion to what each person ate
- PromptPay QR built from the EMVCo spec (TLV + CRC-16) and tested against the widely used
promptpay-qrlibrary for phone, national ID and e-wallet IDs - National ID numbers are checksum-validated before a QR is made
Privacy
Everything runs in the browser. A shared link keeps the bill in the URL's # fragment, which is never sent to any server.