Virtuaaliviivakoodi is clear text implementation of The Federation of Finnish Financial Services' Pankkiviivakoodi ("Finnish bank transfer barcode"). Pankkiviivakoodi's specification can be found on their website (in Finnish).
This program creates Virtuaaliviivakoodi with given parameters. It supports both current versions of Pankkiviivakoodi, version 4 (reference number in national form) and version 5 (reference number in international form, aka Creditor Reference based on ISO 11649).
The library is currently tested with Node.js LTS versions from 12 to 18. It could work on other versions as well, but no support is guaranteed.
First install virtuaaliviivakoodi package from npm in your project.
npm install virtuaaliviivakoodi
After installing the package you can use it in your code. This module returns one simple function when required.
Function accepts one parameter: an object containing information to be included in Virtuaaliviivakoodi. Following parameters are understood:
Name | Type | Attributes | Description |
---|---|---|---|
iban |
String | IBAN formed account number | |
reference |
Number or String | Reference number in either international or national form | |
cents |
Number | optional | Amount in cents (1€ = 100c) with maximum of 99999999 |
due |
String | optional | Due date in form of "YYMMDD" where YY is year, MM is month and DD is day |
Function returns a string containing the Virtuaaliviivakoodi.
const virtuaaliviivakoodi = require('virtuaaliviivakoodi')
const options = {
iban: 'FI37 1590 3000 0007 76',
reference: 11112,
cents: 1225, // 12.25 euros
due: '161221',
}
virtuaaliviivakoodi(options)
// => "437159030000007760000122500000000000000000011112161221"
const virtuaaliviivakoodi = require('virtuaaliviivakoodi')
const options = {
iban: 'FI37 1590 3000 0007 76',
reference: 'RF9811112', // Creditor Reference, ISO 11649
cents: 110, // 1.10 euros
due: '170101',
}
virtuaaliviivakoodi(options)
// => "537159030000007760000011098000000000000000011112170101"