validateRaastQr
function validateRaastQr(payload, options?): RaastQrValidation;Defined in: raast.ts:548
Checks whether a Raast QR code can be paid, e.g. before showing a payment screen or to warn about a tampered sticker.
Errors: not a Pakistani payment QR, checksum mismatch (damaged or edited), no IBAN or an IBAN that fails its checksum, expired, or a fixed-amount QR without the expiry that banking apps require. Warnings: an amount in a static QR (apps ignore it, so the payer must type it), or a QR that expires soon (within an hour by default).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
payload |
string |
Text decoded from the QR code |
options? |
ValidateRaastQrOptions |
Time to check against and the “expires soon” window |
Returns
Section titled “Returns”Validation result with the parsed QR
Example
Section titled “Example”validateRaastQr(scannedText);// { valid: false, errors: ['expired'], warnings: [], qr: { ... } }