/promptparse

💸 PromptPay (and EMVCo-compatible) QR Code Payload Parser and Generator

Primary LanguageTypeScriptMIT LicenseMIT

PromptParse

PromptParse

💸 PromptPay (and EMVCo-compatible) QR Code Payload Parser and Generator

Features

  • Parses PromptPay or other EMVCo-compatible QR Code Data
  • Construct TLV Tags into QR Code Data (uses to create QR Code)
  • Pre-made generators for PromptPay and other Thai QR Standards (and non-standards)

Usage

Parsing data and get value from tag

import { parse } from 'promptparse'

// Example data
const ppqr = parse('000201010211...')

// Get Tag ID '00'
ppqr.getTagValue('00') // Returns '01'

Build QR data

import { encode, tag, withCrcTag } from 'promptparse'

// Example data
const data = [
  tag('00', '01'),
  tag('01', '11'),
  // ...
]

// Set CRC Tag ID '63'
withCrcTag(encode(data), '63') // Retruns '000201010211...'

References

License

This project is MIT licensed (see LICENSE.md)