virtuaaliviivakoodi
v3.1.0
Published
Creates the numeral value of Finnish bank transfer barcode
Downloads
1,680
Maintainers
Readme
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).
Supported Node.js versions
The library requires Node.js 20 or higher. It is tested with Node.js 20, 22, and 24.
Usage
First install virtuaaliviivakoodi package from npm in your project.
npm install virtuaaliviivakoodiAfter installing the package you can use it in your code. This module exports a default function.
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 or object | optional | Due date as "YYMMDD" string, "YYYY-MM-DD" ISO 8601 string, or object with {day, month, year} properties (January = 1) |
Function returns a string containing the Virtuaaliviivakoodi.
Examples
Version 4 (ESM)
import virtuaaliviivakoodi from 'virtuaaliviivakoodi'
const options = {
iban: 'FI37 1590 3000 0007 76',
reference: 11112,
cents: 1225, // 12.25 euros
due: '161221',
}
virtuaaliviivakoodi(options)
// => "437159030000007760000122500000000000000000011112161221"Version 5 (ESM)
import virtuaaliviivakoodi from '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"CommonJS
The package also supports CommonJS:
const virtuaaliviivakoodi = require('virtuaaliviivakoodi')
const options = {
iban: 'FI37 1590 3000 0007 76',
reference: 11112,
cents: 1225,
due: '161221',
}
virtuaaliviivakoodi(options)
// => "437159030000007760000122500000000000000000011112161221"