README
bysquare
Simple Node.js
library to generate "PAY by square" QR
string.
What is PAY by square
?
It's a national standard for payment QR codes adopted by Slovak Banking Association (SBA) in 2013. It is part of a large number of invoices, reminders and other payment regulations.
Can I generate an image?
This library is un-opinionated about generating images. Image generation from qr-code string depends on your implementation. See the examples.
Install
Node.js
npm install bysquare
API
Available functions
generate(model: Model): Promise<string>
import { generate, Model } from 'bysquare';
const model: Model = {
IBAN: 'SK9611000000002918599669',
Amount: 100.0,
CurrencyCode: "EUR",
VariableSymbol: "123",
Payments: 1,
PaymentOptions: 1,
BankAccounts: 1,
};
generate(model).then((qrString) => {
// your logic...
})
parse(qrString: string): Promise<Model>
import { parse } from 'bysquare';
const qr: string = '0005FO5V6G02NE0JSD04M4KD3R71IEMDHVJGQVQ6H573788QDK16QE2RLPHHHGVV7T9FG9OBDJI1V9MAE5A7B4T8FVVS9FOG00';
parse(qrString).then((parsed) => {
// your logic...
});
CLI
Local executable install
npm install --global bysquare
bysquare ./example.json
Executable without installation
npx bysquare ./example.json
file
bysquare ./example.json
$ 0005FO5V6G02NE0JSD04M4KD3R71IEMDHVJGQVQ6H573788QDK16QE2RLPHHHGVV7T9FG9OBDJI1V9MAE5A7B4T8FVVS9FOG00
standard input
$ echo '
{
"IBAN": "SK9611000000002918599669",
"Amount": 100.0,
"CurrencyCode": "EUR",
"VariableSymbol": "123",
"Payments": 1,
"PaymentOptions": 1,
"BankAccounts": 1
}' \
| bysquare
$ 0005FO5V6G02NE0JSD04M4KD3R71IEMDHVJGQVQ6H573788QDK16QE2RLPHHHGVV7T9FG9OBDJI1V9MAE5A7B4T8FVVS9FOG00
License
Distributed under the MIT License. See LICENSE for more information.