Last active
          July 15, 2024 09:02 
        
      - 
      
- 
        Save zerojame/e7f71f5a88c2e19221f9d79305a3818b to your computer and use it in GitHub Desktop. 
    promptpay-qr
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | const generatePayload = require('promptpay-qr') | |
| const qrcode = require('qrcode') | |
| const fs = require('fs') | |
| const mobileNumber = '000-000-0000' | |
| const IDCardNumber = '0-0000-00000-00-0' | |
| const amount = 0 | |
| const payload = generatePayload(mobileNumber, { amount }) //First parameter : mobileNumber || IDCardNumber | |
| console.log(payload) | |
| // Convert to SVG QR Code | |
| const options = { type: 'svg', color: { dark: '#000', light: '#fff' } } | |
| qrcode.toString(payload, options, (err, svg) => { | |
| if (err) return console.log(err) | |
| fs.writeFileSync('./qr.svg', svg) | |
| console.log(svg) | |
| }) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment