Skip to content

Raast QR

import { createRaastP2PQr, createMerchantQr, parseRaastQr, validateRaastQr } from 'pakdatakit/raast'

Builds and reads payment QR payloads following the State Bank of Pakistan’s QR standard (Circular Letter No. 1 of 2022). Turn the returned string into an image with any QR library.

Bank
—
Amount
—
Making the QR code…

0002020102110202000424PK36SCBL000000112345670210045772

import { createRaastP2PQr } from 'pakdatakit';
createRaastP2PQr({ iban: 'PK36SCBL0000001123456702', amount: 1500, expiresIn: '1d', now: new Date(2026, 10, 18, 10, 0) });
// → '0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46'
function createRaastP2PQr(options: {
iban: string;
amount?: number;
expiresAt?: Date;
expiresIn?: string | number; // e.g. '1d', '2h', or milliseconds
bankName?: string;
particulars?: string;
}): string;

Returns the QR payload text.

Caveats. Person-to-person QR codes use scheme 00: banking apps reject the 30 in SBP’s document. A QR with an amount needs expiresAt or expiresIn. Test-scan with your bank’s app before using a QR for payments.

function parseRaastQr(payload: string): ParsedRaastQr | null;

Returns the decoded fields (IBAN, bank, amount, expiry), or null when the text is not a Raast QR.

function validateRaastQr(payload: string, now?: Date): RaastQrValidation;

Returns whether a scanned QR is safe to pay: the CRC, IBAN checksum, amount and expiry, with readable problems.

Related: IBAN and banks, createMerchantQr().