Skip to content

parseBOTBarcode

parseBOTBarcode(barcode): ParsedBOTBarcode | null

Defined in: barcode.ts:108

Parse a BOT 1D bill-payment barcode back into its component fields.

Returns null for any structural issue (missing prefix, wrong field count, biller-id too short) so callers can branch without try/catch. The trailing amount is decoded back to baht (e.g. '364922'3649.22), and the literal “0” sentinel surfaces as undefined.

string

ParsedBOTBarcode | null

parseBOTBarcode('|099999999999990\r111222333444\r\r0')
// → { billerId: '099999999999990', ref1: '111222333444' }
parseBOTBarcode('|099400016550100\r123456789012\r670429\r364922')
// → {
// billerId: '099400016550100',
// ref1: '123456789012',
// ref2: '670429',
// amount: 3649.22,
// }