npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

raast

v0.1.0

Published

Generate Raast payment QR codes compliant with Pakistani banking standards

Readme

Raast QR Code Generator

A JavaScript library for generating Raast payment QR codes compliant with Pakistani banking standards.

Installation

npm install raast

Usage

This library uses neverthrow for type-safe error handling. All functions return ResultAsync objects instead of throwing errors.

Generating a Static QR Code

Static QR codes are reusable and don't contain payment amounts:

import { generatePaymentQrCode } from 'raast';

const result = await generatePaymentQrCode({
  "qr-code-type": "static",
  iban: "PK36SCBL0000001123456702"
});

if (result.isOk()) {
  console.log(result.value.dataUri); // Data URI containing the QR code image
} else {
  console.error(`Error ${result.error.code}: ${result.error.message}`);
  if (result.error.hint) {
    console.log(`Hint: ${result.error.hint}`);
  }
}

Generating a Dynamic QR Code

Dynamic QR codes include amount, description, and expiration:

import { generatePaymentQrCode } from 'raast';

const result = await generatePaymentQrCode({
  "qr-code-type": "dynamic",
  iban: "PK36SCBL0000001123456702",
  amount: "1000.00",
  description: "Payment for services",
  expiration: "2024-12-31T23:59:59"
});

// Using the match pattern for clean error handling
result.match(
  (qrCode) => console.log(qrCode.dataUri),
  (error) => console.error(`${error.code}: ${error.message}`)
);

API

generatePaymentQrCode(data)

Generates a Raast payment QR code.

Parameters

  • data (Object): QR code configuration
    • qr-code-type (string): Either "static" or "dynamic"
    • iban (string): IBAN account number (required)
    • amount (string): Payment amount (required for dynamic QR codes)
    • description (string): Payment description (optional)
    • expiration (string): ISO 8601 date/time string (required for dynamic QR codes)

Returns

Promise<ResultAsync<QrCodeResult, QrCodeError>>

Success value (QrCodeResult):

  • dataUri (string): Data URI containing the QR code image

Error value (QrCodeError):

  • code (string): Error code for programmatic handling (e.g., MISSING_IBAN, INVALID_AMOUNT_TYPE)
  • message (string): Human-readable error message
  • field (string): Field that caused the error
  • hint (string): Helpful suggestion to fix the error
  • Additional context-specific fields (e.g., value, length, maxLength)

Error Codes

  • MISSING_IBAN: IBAN is required
  • INVALID_IBAN_TYPE: IBAN must be a string
  • IBAN_TOO_LONG: IBAN exceeds 99 characters
  • MISSING_AMOUNT: Amount required for dynamic QR codes
  • INVALID_AMOUNT_TYPE: Amount must be a string
  • AMOUNT_TOO_LONG: Amount exceeds 99 characters
  • MISSING_EXPIRATION: Expiration required for dynamic QR codes
  • INVALID_DESCRIPTION_TYPE: Description must be a string
  • DESCRIPTION_TOO_LONG: Description exceeds 99 characters
  • INVALID_CHARACTER: Invalid character in payload
  • QR_GENERATION_FAILED: QR code library error

TypeScript Support

This package includes TypeScript type definitions. Types are automatically available when using TypeScript:

import { generatePaymentQrCode, QrCodeData, QrCodeResult } from 'raast';

const data: QrCodeData = {
  "qr-code-type": "static",
  iban: "PK36SCBL0000001123456702"
};

const result: QrCodeResult = await generatePaymentQrCode(data);

Compatibility

This package supports Raast QR codes for Pakistani mobile banking applications. For a compatibility matrix showing which banking apps support different QR code features, see compatibility.json.

License

MIT