raast library

Raast QR codes: person-to-person and merchant payloads, parsing and validation.

Same as the pakdatakit/raast entry point of the npm package.

Classes

EmvField
A parsed EMV QR field. children is set for template fields.
MerchantAccountInfo
Account details for a merchant QR, as issued by the merchant's bank.
ParsedRaastQr
Result of parseRaastQr.
RaastQrValidation
Result of validateRaastQr.

Enums

RaastQrError
A problem that stops a Raast QR from working or makes it unsafe to pay.
RaastQrKind
Kind of Raast QR code.
RaastQrWarning
Something worth telling the payer, but which does not stop payment.

Functions

createMerchantQr({required MerchantAccountInfo merchantAccount, required String merchantName, required String city, String? mcc, num? amount, bool? isDynamic, String? billNumber, String? mobileNumber, String? reference, DateTime? dueDate, num? amountAfterDueDate}) → String
Creates an EMVCo merchant-presented QR payload following SBP's Pakistan QR standard (currency 586, country PK, CRC in tag 63), including the Pakistan-specific due-date fields.
createRaastP2PQr({required String iban, String? scheme, num? amount, DateTime? expiresAt, Object? expiresIn, String? bankName, String? particulars, DateTime? now}) → String
Creates a Raast person-to-person QR payload in SBP's P2P QR format (payload format 02), matching the QR codes banking apps generate, so it can be scanned by apps such as Easypaisa and JazzCash. Encode the string as a QR code with any QR library.
parseRaastQr(String payload) → ParsedRaastQr?
Parses a Raast QR payload: either a person-to-person QR (payload format 02) or an EMVCo merchant QR (payload format 01), and verifies its CRC.
validateRaastQr(String payload, {DateTime? now, int expiresSoonMs = 3600000}) → RaastQrValidation
Checks whether a Raast QR code can be paid, e.g. before showing a payment screen or to warn about a tampered sticker.