Skip to content

Results ​

Starting a payment returns one of five classes exported from @laranex/myanmar-payments. Each has a read-only flow property, and PaymentResult is their union, so a switch on payment.flow tells them apart. Fields a gateway did not provide are undefined.

RedirectPayment ​

Returned by kbz.pwa() and wave.initiate().

FieldTypeDescription
flow'redirect'PaymentFlow.Redirect
orderIdstringYour order ID, as sent to the gateway
urlstringThe gateway page to redirect the customer to
gatewayReferencestring | undefinedThe gateway's ID for this attempt (KBZ prepay_id, Wave transaction_id)
rawRecord<string, unknown>The gateway's response, for logging

FormPayment ​

Returned by aya.initiate() and cs.hostedCheckout().

Field / MethodTypeDescription
flow'form'PaymentFlow.Form
orderIdstringYour order ID
actionstringThe gateway URL the form posts to
fieldsreadonly FormField[]The signed hidden fields ({ name, value }) in order. Post them unchanged
enctypestringThe encoding the gateway expects; application/x-www-form-urlencoded unless the gateway needs another (AYA: multipart/form-data)
toHtml(nonce?)stringA complete, escaped page that submits the form on load. Pass your Content Security Policy nonce to add it to the inline <script>; an empty nonce adds none
field(name)string | undefinedOne field's value
values()Record<string, string>The fields as an object

FormField is { readonly name: string; readonly value: string }.

QrPayment ​

Returned by kbz.qr(), yoma.initiate() and yoma.renewQr().

Field / MethodTypeDescription
flow'qr'PaymentFlow.Qr
orderIdstringYour order ID
qrStringstring | undefinedA QR payload to encode yourself (KBZ Pay)
qrImagestring | undefinedA base64 image to display as is (Yoma MMQR)
expiresAtDate | undefinedWhen the QR stops being payable; undefined when the gateway sets no limit
referencestring | undefinedThe gateway's ID for this QR, used for status checks (Yoma refLabel, KBZ prepay_id)
rawRecord<string, unknown>The gateway's response, for logging
qrImageDataUri(mimeType?)string | undefinedqrImage as a data URI; mimeType defaults to image/png. undefined when there is no image

AppPayment ​

Returned by kbz.app(). JSON.stringify(payment) writes orderId, orderInfo, sign and signType, the names the KBZ Pay SDK uses.

Field / MethodTypeDescription
flow'app'PaymentFlow.App
orderIdstringYour order ID
orderInfostringThe signed order string the SDK expects
signstringThe signature of orderInfo
signTypestringThe signature algorithm, SHA256
rawRecord<string, unknown>The gateway's response; left out of toJSON()
toJSON(){ orderId, orderInfo, sign, signType }The values your app needs

MiniAppPayment ​

Returned by miniApp.payment(). No request is sent: pass JSON.stringify(payment) or payment.toJsonString() to your mini app page, which hands it unchanged to WaveJsSDK.paymentModule.makePayment().

Field / MethodTypeDescription
flow'mini_app'PaymentFlow.MiniApp
orderIdstringYour order ID (orderID)
amountAmountThe signed total, in whole kyat
miniAppIdstringThe configured mini app ID (miniAppID)
merchantReferenceIdstringYour ID for this attempt (merchantRefID)
callbackUrlstringThe signed callback URL (callBackUrl)
hashValuestringThe payload's hash (hashValue)
itemsreadonly MiniAppPaymentItem[]The line items, { name: string; amount: Amount }
toJSON()MiniAppPaymentPayloadExactly the makePayment object: amount, miniAppID, merchantRefID, orderID, callBackUrl, hashValue, items (name, amount), amounts as numbers. An amount above Number.MAX_SAFE_INTEGER keeps every digit through JSON.rawJSON (Node.js 21+) and throws a RangeError without it
toJsonString()stringThe same object as compact JSON, amounts as JSON integers with every digit on every Node.js version

PaymentFlow ​

A string union, so payment.flow === 'redirect' works too.

ConstantValueClass
PaymentFlow.RedirectredirectRedirectPayment
PaymentFlow.FormformFormPayment
PaymentFlow.QrqrQrPayment
PaymentFlow.AppappAppPayment
PaymentFlow.MiniAppmini_appMiniAppPayment

PaymentFlow is also a type: 'redirect' | 'form' | 'qr' | 'app' | 'mini_app'.

raw values are plain JavaScript values, with JSON numbers kept as their exact text in a string (1000.50 stays "1000.50"), never a rounded number. JSON.stringify(payment.raw) logs them.