ข้ามไปยังเนื้อหา

ThaiQRPaymentBuilder

Defined in: payload/dist/builder.d.ts:66

Thai QR Payment payload builder.

Three terminal methods:

  • .build() returns the wire-format string ready for QR encoding.
  • .buildWithChecksum() returns both the body and the checksum separately — useful for debugging the CRC step.
  • .toBytes() returns a Uint8Array of the ASCII-encoded payload for callers that want to hash or sign it.

new ThaiQRPaymentBuilder(): ThaiQRPaymentBuilder

Defined in: payload/dist/builder.d.ts:74

ThaiQRPaymentBuilder

additionalData(fields): this

Defined in: payload/dist/builder.d.ts:145

Set sub-fields of the additional-data template (tag 62).

AdditionalDataFields

this


amount(value, options?): this

Defined in: payload/dist/builder.d.ts:139

Set the transaction amount in baht. Pass {fromSatang: true} to supply integer satang instead. Omit / pass undefined to keep the QR static (the consumer’s banking app will prompt for an amount).

number | bigint | undefined

FormatAmountOptions

this


bankAccount(bankCode, accountNo): this

Defined in: payload/dist/builder.d.ts:90

Configure a PromptPay credit transfer to a bank account (sub-tag 04). bankCode is the 3-digit BoT bank identifier; accountNo is the variable-length numeric account.

string

string

this

new ThaiQRPaymentBuilder().bankAccount('014', '1234567890').amount(100).build()

billPayment(input): this

Defined in: payload/dist/builder.d.ts:128

Configure a BillPayment recipient (Cross-Bank BillPayment / R-Bill).

Pass crossBorder: true to emit the ASEAN-region remittance AID (A000000677012006) instead of the domestic one (A000000677010112). The template layout is otherwise identical — same sub-tags, same value rules. Pair with the purposeOfTransaction additional-data field (tag 62 sub-tag 08), which carries an 18-char triple in this mode: currencyCode (3 digits) + localAmount (13 digits) + countryCode (2 digits). The builder treats that field as opaque; compose / parse the triple at the call site.

string

boolean

string

string

this


build(): string

Defined in: payload/dist/builder.d.ts:163

Render the full wire-format payload with checksum appended.

string


buildWithChecksum(): object

Defined in: payload/dist/builder.d.ts:165

Render and split the body/CRC for inspection.

object

body: string

checksum: string

payload: string


merchant(info): this

Defined in: payload/dist/builder.d.ts:143

Set merchant display info (tags 52, 59, 60, 61).

MerchantInfo

this


ota(otaCode): this

Defined in: payload/dist/builder.d.ts:99

Attach a One-Time Authorization code (sub-tag 05, fixed 10 chars). Flips the merchant template’s AID from the standard PromptPay GUID to the OTA GUID so scanners route the payload to the single-use flow.

string

this

new ThaiQRPaymentBuilder().promptpay('0812345678').ota('1234567890').amount(50).build()

pointOfInitiation(method): this

Defined in: payload/dist/builder.d.ts:157

Force the point-of-initiation flag regardless of amount presence.

"static" | "dynamic"

this


promptpay(recipient, type?): this

Defined in: payload/dist/builder.d.ts:81

Configure a PromptPay recipient (mobile, national ID, or e-wallet). Overrides any previously-set BillPayment / KShop template. Use .bankAccount() for credit-transfer payloads — its wire value needs the (bankCode, accountNo) split this single-string form cannot carry.

string

PromptPayRecipientType

this


tipPolicy(mode): this

Defined in: payload/dist/builder.d.ts:141

Set the tip / convenience-fee policy (tags 55-57).

TipMode | undefined

this


toBytes(): Uint8Array

Defined in: payload/dist/builder.d.ts:171

UTF-8 byte view of the payload — useful for hashing or transport.

Uint8Array


trueMoney(mobileNo, options?): this

Defined in: payload/dist/builder.d.ts:112

Configure a TrueMoney Wallet recipient. Same merchant template tag (29) as PromptPay but with the literal 14 prefix on sub-tag 03 so the TrueMoney app can disambiguate its own payloads from a plain e-wallet QR. The mobile is zero-padded on the left to 13 digits before the prefix is added (final value length is always 15).

The optional message is carried in tag 81 (UTF-16BE hex) and is surfaced inside the TrueMoney app only; other scanners ignore it.

string

number

string

this


vatTqrc(input): this

Defined in: payload/dist/builder.d.ts:155

Attach the Bank of Thailand VAT TQRC extension (tag 80). Promotes the payment QR to an e-tax-receipt source. Pass undefined to clear.

Field-length rules come from the BOT extension spec:

  • sellerTaxBranchId is exactly 4 characters
  • vatRate is 1–5 characters when present (e.g. “7” or “7.00”)
  • vatAmount is 1–13 characters and required

VATTQRCInput | undefined

this