Skip to main content
Deno 2 is finally here 🎉️
Learn more

Deno PromptPay

Generate Thai PromptPay QR code string and Base64-encoded images in Deno.

Build Status GitHub Contributors

Getting started

import { PromptPay } from "https://deno.land/x/promptpay/mod.ts";

const promptpay = new PromptPay("0812345678", 1000);
const qrCodeString = promptpay.generate();
const base64Image = promptpay.generateBase64Data(); // Base64-encoded image
const base64Image300px = promptpay.generateBase64Data(300); // Base64-encoded image 300x300px
base64Image300px.then((qr) => {
  console.log(qr);
});

Example

import { PromptPay } from "https://deno.land/x/promptpay/mod.ts";

const promptpay = new PromptPay("0812095124", 50);
const base64Image300px = promptpay.generateBase64Data(300); // Base64-encoded image

base64Image300px.then((qr) => {
  console.log(qr);
});

QR code

Development

Run tests:

deno test

Dependency

  1. QR generator by denorg/qrcode

License

  • MIT © Chonchanok MueangRuangWit and contributors