Socket
Socket
Sign inDemoInstall

sgqr-code

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    sgqr-code

Generate SGQR Code for PayNow transactions in Node.js


Version published
Weekly downloads
2
increased by100%
Maintainers
1
Install size
24.4 kB
Created
Weekly downloads
 

Readme

Source

Singapore Quick Response Code (SGQR)

Effortlessly generate your Singapore Quick Response Code (SGQR) Code for PayNow transactions. Quickly set predefined amounts and reference numbers for seamless peer-to-peer transfers across major banks and non-financial institutions in Singapore.

A Node.js package to generate Singapore Quick Response Code (SGQR) for PayNow transactions.

Installation

npm install sgqr-code --save

Usage

const { getPaynowQRCode } = require('sgqr-code');

// Example Usage
try {
    const qrCode = getPaynowQRCode({
        phone: '+6512345678'
    });

    console.log(qrCode);
} catch (error) {
    console.log(error);
    console.error('Error generating QR code:', error.message);
}

// Example Usage: 1
const qrCode = getPaynowQRCode({
  merchantName: 'MyMerchant',
  amount: 25.99,
  uen: '123456789A',
});

// Example Usage: 2
const qrCode = getPaynowQRCode({
  amount: 25.99,
  phone: '+6512345678',
});

// Example Usage: 3
const qrCode = getPaynowQRCode({
  uen: '123456789A',
});

// Example Usage: 4
const qrCode = getPaynowQRCode({
  initiationMethod: '12',
  referenceNumber: '123456',
  merchantName: 'MyMerchant',
  amount: 25.99,
  amountEditable: '0',
  uen: '123456789A',
  transactionCurrency: '702',
  countryCode: 'SG',
  merchantCity: 'Singapore',
  uniqueIdentifier: 'SG.PAYNOW',
  expiryDate: '20230101120000', // Optional, format: YYYYMMDD or YYYYMMDDHHMMSS
});

console.log(qrCode);

getPaynowQRCode Object Param Values

ParameterDescriptionDefault ValueMaximum LengthMandatory
initiationMethodInitiation method for the transaction. '11' Static or '12' Dynamic'12' (Dynamic)N/AYes
referenceNumberReference number for the transaction.Auto-generated99Yes
merchantNameName of the merchant.'NA'25Yes
amountTransaction amount.nullN/ANo
amountEditableWhether the amount is editable or not.'0'N/AYes
uenUEN (Unique Entity Number) of the merchant.null16No
phoneSG Phone number including +65null16No
transactionCurrencyCurrency code for the transaction.'702'3Yes
countryCodeCountry code of the merchant.'SG'2Yes
merchantCityCity of the merchant.'Singapore'15Yes
uniqueIdentifierUnique identifier for PayNow transactions.'SG.PAYNOW'9Yes
expiryDateExpiry date for the QR code.null (Optional)14No

Note:

  • initiationMethod should be either '11' for Static or '12' for Dynamic QR code.
  • If amount is null, amountEditable will be set to '0' (non-editable).
  • Either uen or phone can be provided. If both are provided, uen will be considered by default.
  • phone should be a Singapore phone number starting with +65 and followed by 8 digits.
  • expiryDate (if provided) should be in the format YYYYMMDD or YYYYMMDDHHMMSS and must be greater than the current date and time.

Keywords

FAQs

Last updated on 20 Jan 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc