Setting the IBAN
Every Raast QR needs a destination account. A Pakistani IBAN is 24 characters: the country code PK, two check digits, a four-letter bank code, and sixteen alphanumeric characters for the account.
Setting It Explicitly
RaastQr::iban('PK33ABCD0000000000000000')->amount('2500')->toPng();Or on a builder you already have:
RaastQr::make()->iban($vendor->iban)->amount($order->total)->toPng();Falling Back to Config
If you leave the IBAN off, the package uses config('raast-qr.iban'):
// .env
// RAAST_QR_IBAN=PK33ABCD0000000000000000
RaastQr::make()->amount('2500')->toPng();This is the right setup when all money lands in one account. For a marketplace, leave the config value null so a missing IBAN fails loudly instead of quietly billing the wrong account.
Normalisation
Spaces and lowercase are fine. The package strips and uppercases before encoding:
RaastQr::iban('pk33 abcd 0000 0000 0000 0000')->toPayload();
// identical to PK33ABCD0000000000000000You can normalise manually too:
RaastQr::normalizeIban('pk33 abcd 0000 0000 0000 0000');
// 'PK33ABCD0000000000000000'Formatting for Display
Never show a user an unbroken 24-character string if you can help it:
RaastQr::formatIban('PK33ABCD0000000000000000');
// 'PK33 ABCD 0000 0000 0000 0000'
RaastQr::formatIban('PK33ABCD0000000000000000', '-');
// 'PK33-ABCD-0000-0000-0000-0000'Display only
Never feed a formatted IBAN back into the payload. Use normalizeIban() for that, or just pass the original — the builder normalises for you.
Checking Validity
RaastQr::isValidIban('PK33ABCD0000000000000000'); // true
RaastQr::isValidIban('PK00ABCD0000000000000000'); // false — checksum
RaastQr::isValidIban('GB33ABCD0000000000000000'); // false — not PakistaniThis runs the full ISO 13616 mod-97 checksum, not just a pattern match, so a single mistyped digit is caught.
For form input, use the validation rule instead of calling this by hand.
Errors
Passing an IBAN that fails validation throws when you ask for output:
try {
RaastQr::iban('PK00ABCD0000000000000000')->toPng();
} catch (RaastQrException $e) {
$e->reason(); // 'INVALID_IBAN'
}Made with ❤️ from Pakistan