GithubHelp home page GithubHelp logo

wynsto / fps-hk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryanchanplc/node-fps-hk

0.0 0.0 0.0 105.03 MB

A tool to generate the QR code content string used by Faster Payment System in Hong Kong

License: MIT License

JavaScript 100.00%

fps-hk's Introduction

hk-fps

This project is forked from node-hk-fps

A Nodejs module that help to generate QR code content string of the Hong Kong Faster Payment System. Please refer the blog

added support for mobile number and email address.

Installation

Install with npm

npm install fps-hk

and in your code

var  fps = require('fps-hk')

Usage

'//import module
// fps.reset()
// fps.setMerchantID("0000001"); FPS ID 
// only works on mobile phone number or email address
fps.setMerchantMobileNumber("+852-12345678"); 
fps.setBankCode("004"); // only works on mobile phone number or email address
// fps.setMerchantEmail("[email protected]");
fps.setBillNumber("0002");
fps.setStoreLabel("0003");
fps.setLoyaltyNumber("0004");
fps.setCustomerLabel("0005");
fps.setTerminalLabel("0006");
fps.setPurposeOfTransaction("0007");
fps.setMobileNumber("12345678");
fps.setTransactionAmount("5000");
fps.setReferenceLabel("ABCD");
const string = fps.generate();
const code = qrimage.image(string, { type: 'png' });
res.setHeader('Content-type', 'image/png');  //sent qr image to client side
code.pipe(res);

//generate qr content string
var  qrContent = fps.generate();

Example

cd ./example
npm install
node index.js

visit http://localhost:8080

License

MIT

Useful Links

Please find the specification of the QR Code used in FPS at: https://fps.hkicl.com.hk/eng/fps/merchants/qr_code.php

The QR Code content string used in FPS contains the CRC16 CCITT check sum. Please find more details at: http://www.sunshine2k.de/articles/coding/crc/understanding_crc.html

fps-hk's People

Contributors

wynsto avatar ryanchanplc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.