npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

promptpay-js

v1.0.7

Published

PromptPay Generator and Parser for Node.js

Downloads

262

Readme

PromptPay

NPM Version NPM Downloads

PromptPay Generator and Parser for Node.js

Install

$ npm install promptpay-js

Method

Generate

| Name | Type | Length | Required | Description | |-----------------------------------|--------|--------|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | method | Enum | | Required | - QR_STATIC- QR_DYNAMIC- BLE_STATIC- BLE_DYNAMIC- NFC_STATIC- NFC_DYNAMIC | | application | Enum | | Required | - PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDER | | mobileNumber | String | 13 | Conditioned | For application- PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA | | nationalID | String | 13 | Conditioned | For QR_DYMANIC method only.For application- PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA | | taxID | String | 13 | Conditioned | For application- PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA | | eWalletID | String | 15 | Conditioned | For application- PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA | | bankAccount | String | 1 - 43 | Conditioned | Bank code (3 digits) + account no.For application- PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_CREDIT_TRANSFER_WITH_OTA | | ota | String | 10 | Conditioned | For PROMPTPAY_CREDIT_TRANSFER_WITH_OTA application only. | | billerID | String | 15 | Conditioned | National ID/Tax ID + SuffixFor application- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDER | | reference1 | String | 1 - 20 | Conditioned | For application- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDER | | reference2 | String | 1 - 20 | Optional | For application- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDER | | mcc | String | 4 | Optional | As defined by ISO 8583:1993 for Card Acceptor Business Code (MCC). | | currencyCode | String | 3 | Required | 764 for Thai Baht (ISO 4217). | | amount | String | 1 - 13 | Optional | This amount is expressed as to how the value appears,amount "100.00" is defined as "100.00", or amount "99.85" is defined as "99.85", or amount "99.333" is defined as "99.333"amount "99.3456" is defined as "99.3456" | | tip | String | 1 - 13 | Optional | The convenience fee of a fixed amount should be specified here.This amount is expressed as to how the value appears,amount "100.00" is defined as "100.00", oramount "99.85" is defined as "99.85", oramount "99.333" is defined as "99.333"amount "99.3456" is defined as "99.3456"Note: 0 is not a valid value. | | countryCode | String | 2 | Required | TH for Thailand (ISO 3166-1 alpha-2). | | merchantName | String | 1 - 25 | Optional | | | merchantCity | String | 1 - 15 | Optional | | | postalCode | String | 1 - 10 | Optional | Zipcode or Pin code or Postal code of the merchant. | | additional | Object | | Optional | Additional information may be required in certain cases.This information may be either presented by the merchant or acquireror the Consumer may be prompted for entry on the app. | | additional.billNumber | String | 1 - 26 | Optional | Invoice number or bill number. | | additional.mobileNumber | String | 1 - 26 | Optional | To be used for top-up or bill payment. | | additional.storeID | String | 1 - 26 | Optional | A distinctive number associated to the store. | | additional.loyaltyNumber | String | 1 - 26 | Optional | As defined by store or airline. | | additional.referenceID | String | 1 - 26 | Optional | As defined by merchant or acquirer. | | additional.customerID | String | 1 - 26 | Optional | Typically a subscriber ID for subscription services or student. | | additional.terminalID | String | 1 - 26 | Optional | A distinctive number associated with the terminal in the store.For application- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDER | | additional.purposeOfTransaction | String | 1 - 26 | Optional | For application- PROMPTPAY_BILL_PAYMENT- PROMPTPAY_BILL_PAYMENT_CROSS_BORDERCurrency Code (3 digits) +Local Amount (13 digits) +Country Code (2 digits) | | additional.additionalCustomerData | String | 1 - 3 | Optional | | | merchantInformation | String | 1 - 99 | Optional | | | sellerTaxBranchID | String | 4 | Optional | VAT TQRC | | vatRate | String | 1 - 5 | Optional | | | vatAmount | String | 1 - 13 | Conditioned | |

Parse

| Name | Type | Required | Description | |---------|--------|----------|------------------------------------------------------------------------------------| | payload | String | Required | | | tagType | Enum | Optional | - PROMPTPAY_CREDIT_TRANSFER- PROMPTPAY_BILL_PAYMENT- ADDITIONAL_DATA_FIELD |

Usage

Generate

const promptpay = require('promptpay-js')

const payload = promptpay.generate({
  method: 'QR_STATIC',
  application: 'PROMPTPAY_CREDIT_TRANSFER',
  mobileNumber: '0066XXXXXXXXX',
  currencyCode: '764',
  countryCode: 'TH'
})

console.log(payload)
00020101021129370016A00000067701011101130066XXXXXXXXX53037645802TH6304D37F

Parse

const promptpay = require('promptpay-js')

const payload = '00020101021129370016A00000067701011101130066XXXXXXXXX53037645802TH6304D37F'
const data = promptpay.parse(payload)

console.log(data)
{
  "00": { "key": "PAYLOAD_FORMAT_INDICATOR", "value": "01" },
  "01": { "key": "POINT_OF_INITIATION_METHOD", "value": "11" },
  "29": {
    "key": "PROMPTPAY_CREDIT_TRANSFER",
    "value": {
      "00": { "key": "AID", "value": "A000000677010111" },
      "01": { "key": "MOBILE_NUMBER", "value": "0066XXXXXXXXX" }
    }
  },
  "53": { "key": "CURRENCY_CODE", "value": "764" },
  "58": { "key": "COUNTRY_CODE", "value": "TH" },
  "63": { "key": "CRC", "value": "D37F" }
}

License

MIT