Appearance
Types & Interfaces
TLV
typescript
interface TLV {
readonly tag: string
readonly name: string
readonly length: number
readonly value: string
readonly children?: readonly TLV[]
}A single Tag-Length-Value element. children is present for container tags (26–51 for merchant templates, 62 for additional data).
QRISDocument
typescript
interface QRISDocument {
readonly raw: readonly TLV[]
readonly payloadFormat: string
readonly method: 'static' | 'dynamic'
readonly poi: '11' | '12'
readonly merchantName: string
readonly merchantCity: string
readonly merchantCategory: string
readonly merchantCategoryLabel: string
readonly currency: string
readonly country: string
readonly postalCode?: string
readonly amount?: number
readonly convenienceFee?: FeeInfo
readonly providers: readonly ProviderInfo[]
readonly accounts: readonly AccountInfo[]
readonly additionalData?: Record<string, string>
readonly crc: string
}The central data model. Produced by fromString() and create(), consumed by verify(), charge(), encode(), and format().
ProviderInfo
typescript
interface ProviderInfo {
readonly templateTag: string
readonly name: string
readonly guid: string
}Identifies a payment provider (e.g. DANA, GoPay, ShopeePay) found in a merchant account template.
| Field | Description |
|---|---|
templateTag | The merchant template tag (e.g. "26") |
name | Human-readable provider name |
guid | Raw GUID from template subtag 00 |
AccountInfo
typescript
interface AccountInfo {
readonly providerTag: string
readonly pan?: string
readonly merchantId?: string
readonly merchantCriteria?: string
}Payment account details extracted from a merchant template.
| Field | Description |
|---|---|
providerTag | The merchant template tag (e.g. "26") |
pan | Merchant account number / PAN (subtag 01) |
merchantId | Merchant ID (subtag 02) |
merchantCriteria | Merchant criteria (subtag 03) |
FeeOption
typescript
interface FeeOption {
readonly type: 'fixed' | 'percentage'
readonly value: number
}Convenience fee configuration. Passed to charge() or setAmount().
type | value unit |
|---|---|
fixed | Amount in IDR (e.g. 2000 for Rp2.000) |
percentage | Percentage (e.g. 2.5 for 2.5%) |
VerifyIssue
typescript
interface VerifyIssue {
readonly severity?: 'error' | 'warning'
readonly message: string
readonly code: string
readonly tag?: string
readonly position?: number
}A single validation issue returned by verify(). An empty array means the document is valid.
| Field | Description |
|---|---|
severity | "error" (default) or "warning" |
message | Human-readable description |
code | Machine-readable error code (e.g. MISSING_TAG, DUPLICATE_TAG) |
tag | The TLV tag the issue relates to, if applicable |
position | Byte position in the raw string, if applicable |
QRISConfig
typescript
interface QRISConfig {
readonly merchantName: string
readonly merchantCity: string
readonly merchantCategoryCode?: string
readonly countryCode?: string
readonly currency?: string
readonly postalCode?: string
readonly accounts: readonly QRISAccountConfig[]
}Configuration object for create().
QRISAccountConfig
typescript
interface QRISAccountConfig {
readonly guid: string
readonly pan?: string
readonly merchantId?: string
readonly merchantCriteria?: string
}A single payment account definition for create().
| Field | Description |
|---|---|
guid | Payment provider GUID (e.g. "ID.DANA.WWW") |
pan | Merchant account number / PAN |
merchantId | Merchant ID |
merchantCriteria | Merchant criteria |
QRISError
typescript
class QRISError extends Error {
readonly code: string
readonly tag?: string
readonly position?: number
constructor(message: string, code: string, tag?: string, position?: number)
}The single error class used throughout the library. Thrown by fromString(), charge(), setAmount(), and create().
| Property | Description |
|---|---|
message | Human-readable description |
code | Machine-readable error code (e.g. INVALID_POI, ALREADY_DYNAMIC, NO_ACCOUNTS) |
tag | The TLV tag that caused the error, if applicable |
position | Byte position in the raw string, if applicable |
Error codes:
| Code | Thrown by | Condition |
|---|---|---|
INVALID_POI | fromString | Point of Initiation method is missing or not 11/12 |
ALREADY_DYNAMIC | charge | Document is already dynamic |
INVALID_AMOUNT | setAmount | Amount is zero, negative, or non-integer |
INVALID_FEE | setAmount | Fee is negative or percentage exceeds 100 |
NO_ACCOUNTS | create | No payment accounts provided |
TOO_MANY_ACCOUNTS | create | More than 26 accounts |
TagInfo
typescript
type TagCategory =
| 'header'
| 'merchant'
| 'classification'
| 'financial'
| 'location'
| 'additional'
| 'integrity'
interface TagInfo {
readonly name: string
readonly required: boolean
readonly category: TagCategory
readonly pattern?: RegExp
readonly description?: string
}Schema metadata for each TLV tag. Used internally by the tag registry (TAG_SCHEMA).