# Raast QR

> Create, read and check Raast payment QR codes following the State Bank of Pakistan's QR standard.

Source: https://pakdatakit.dev/docs/raast/

`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.

- [Generate a printable Raast QR → raast-qr.com](https://raast-qr.com/): For a QR to print or share, with your bank's name and a download.

## Example

**TypeScript**

```ts
import { createRaastP2PQr } from 'pakdatakit';

createRaastP2PQr({ iban: 'PK36SCBL0000001123456702', amount: 1500, expiresIn: '1d', now: new Date(2026, 10, 18, 10, 0) });
// → '0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46'
```

**Python**

```python
from datetime import datetime
from pakdatakit import create_raast_p2p_qr

create_raast_p2p_qr(iban='PK36SCBL0000001123456702', amount=1500, expires_in='1d', now=datetime(2026, 11, 18, 10, 0))
# → '0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46'
```

**Dart**

```dart
import 'package:pakdatakit/pakdatakit.dart';

createRaastP2PQr(iban: 'PK36SCBL0000001123456702', amount: 1500, expiresIn: '1d', now: DateTime(2026, 11, 18, 10, 0));
// → '0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46'
```

**C#**

```csharp
using PakDataKit;

RaastQr.CreateP2P(new RaastP2POptions { Iban = "PK36SCBL0000001123456702", Amount = 1500, ExpiresIn = "1d", Now = new DateTime(2026, 11, 18, 10, 0, 0) });
// → "0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46"
```

**PHP**

```php
use PakDataKit\RaastQr;

RaastQr::createP2P(['iban' => 'PK36SCBL0000001123456702', 'amount' => 1500, 'expiresIn' => '1d', 'now' => new DateTimeImmutable('2026-11-18 10:00:00')]);
// → '0002020102120202000424PK36SCBL00000011234567020504150007121911202610001004CD46'
```

## Reference

### createRaastP2PQr()

```ts
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.

### parseRaastQr()

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

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

### validateRaastQr()

```ts
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](https://pakdatakit.dev/docs/iban/), [`createMerchantQr()`](https://pakdatakit.dev/api/typescript/raast/functions/createmerchantqr/).
