ISO 8583 parser written in TypeScript with LLVAR/LLLVAR enforcement, bitmap handling and built-in field level BCD/ASCII encoding.
npm install @tikpay/iso8583-ts
▀ ▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄ ▄▄▄▄ ▄
▄▄▄ ▄▄▄ ▄▄▄ █ █ █ █ █ ▀ ▀█ ▄▄█▄▄ ▄▄▄
█ █ ▀ █▀ ▀█ ▀▄▄▄▄▀ ▀▀▀▀▄▄ ▀▄▄▄▄▀ ▄▄▄▀ █ █ ▀
█ ▀▀▀▄ █ █ █ ▀█ █ █ ▀█ ▀█ ▀▀▀ █ ▀▀▀▄
▄▄█▄▄ ▀▄▄▄▀ ▀█▄█▀ ▀█▄▄▄▀ ▀▄▄▄█▀ ▀█▄▄▄▀ ▀▄▄▄█▀ ▀▄▄ ▀▄▄▄▀
---
A fast and type-safe ISO 8583 parser/encoder written in TypeScript, with strict LLVAR/LLLVAR enforcement, bitmap handling and built-in field level BCD/ASCII encoding.
---
✔️ Type-safe message building & parsing\
✔️ Field level BCD/ASCII encoding configuration\
✔️ LLVAR / LLLVAR length enforcement\
✔️ Bitmap parsing and generation\
✔️ Dual build: ESM + CJS
``bash`
npm i @tikpay/iso8583-ts
---
`typescript`
import { Iso8583, N, AN, ANS, B, bitmap } from '@tikpay/iso8583-ts' //ESM
or
`typescript`
const { Iso8583, N, AN, ANS, B, bitmap } = require('@tikpay/iso8583-ts') //CJS
---
`typescript
import { AN, bitmap, LLVARn... } from '@tikpay/iso8583-ts'
export const sampleSpec: MessageSpec = {
0: { name: 'MTI', format: N(4, { encoding: NumericEncoding.BCD }) }, //optional
1: { name: 'Bitmap', format: bitmap(8) }, //optional
2: {
name: 'PAN',
format: LLVARn({
length: 19,
lenHeader: VarLenHeaderEncoding.BCD,
payload: VarPayloadEncoding.BCD_DIGITS,
lenCountMode: VarLenCountMode.DIGITS,
}),
},
22: { name: 'POSData', format: AN(12) },
35: { name: 'Track2', format: LLVARans({ length: 37 }) },
}
`
---
`typescript
const iso8583 = new Iso8583(sampleSpec)
const mti = '0200'
const paymentCall = {
3: '000000',
4: '00001000',
11: '123456',
12: '250910142500',
22: '9010A0B00000',
49: '036',
}
const { bytes, mti: packedMti } = iso8583.pack(mti, paymentCall)
`
---
`typescript
const iso8583 = new Iso8583(sampleSpec)
const decoded = iso8583.unpack(bytes)
console.log(decoded.mti) // '0200'
console.log(decoded.fields) // { 3: '000000', 4: '00001000', ... }
``
This library was inspired by excellent work from other ISO 8583 projects, including:
- @jpos/jPOS
- @zemuldo/iso_8583
- @micham/iso8583
This project is licensed under the terms of the MIT open source license.