Skip to content

Results ​

Starting a payment returns a pointer to one of five structs from the root package myanmarpayments. Each implements PaymentResult, whose Flow() method returns a PaymentFlow, so a type switch or Flow() tells them apart. On error the result is nil. Fields a gateway did not provide are "".

RedirectPayment ​

Returned by kbz.PWA() and wave.Initiate().

Field / MethodTypeDescription
Flow()PaymentFlowFlowRedirect
OrderIDstringYour order ID, as sent to the gateway
URLstringThe gateway page to redirect the customer to
GatewayReferencestringThe gateway's ID for this attempt (KBZ prepay_id, Wave transaction_id)
Rawmap[string]anyThe gateway's response, for logging

FormPayment ​

Returned by aya.Initiate() and cs.HostedCheckout().

Field / MethodTypeDescription
Flow()PaymentFlowFlowForm
OrderIDstringYour order ID
ActionstringThe gateway URL the form posts to
Fields[]FormFieldThe signed hidden fields in order. Post them unchanged
EnctypestringThe encoding the gateway expects: multipart/form-data (AYA) or application/x-www-form-urlencoded (CyberSource)
HTML()stringA complete page that submits the form on load. Every value is HTML-escaped (" as ", ' as ')
HTMLWithNonce(nonce)stringThe HTML() page with your Content-Security-Policy nonce (escaped) on the inline <script>. An empty nonce gives the same page as HTML()
Field(name)(string, bool)One field's value
Values()map[string]stringThe fields as a map

FormField is a struct with Name string and Value string.

QrPayment ​

Returned by kbz.QR(), yoma.Initiate() and yoma.RenewQR().

Field / MethodTypeDescription
Flow()PaymentFlowFlowQR
OrderIDstringYour order ID
QRStringstringA QR payload to encode yourself (KBZ Pay)
QRImagestringA base64 image to display as is (Yoma MMQR)
ExpiresAttime.TimeWhen the QR stops being payable: now + the time to live (KBZ Pay) or QRLifetime, 120 seconds (Yoma MMQR)
ReferencestringThe gateway's ID for this QR, used for status checks (Yoma refLabel, KBZ prepay_id)
Rawmap[string]anyThe gateway's response, for logging
QRImageDataURI(mimeType)stringQRImage as a data URI; "" as mimeType means image/png. "" when there is no image

AppPayment ​

Returned by kbz.App(). It encodes to JSON as orderId, orderInfo, sign and signType, the names the KBZ Pay SDK uses.

Field / MethodTypeDescription
Flow()PaymentFlowFlowApp
OrderIDstringYour order ID
OrderInfostringThe signed order string the SDK expects
SignstringThe signature of OrderInfo
SignTypestringThe signature algorithm, SHA256
Rawmap[string]anyThe gateway's response; left out of the JSON encoding

MiniAppPayment ​

Returned by miniApp.Payment(). No request is sent: write JSON() to your mini app page, which hands it unchanged to WaveJsSDK.paymentModule.makePayment().

Field / MethodTypeDescription
Flow()PaymentFlowFlowMiniApp
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)
Items[]MiniAppItemThe line items, each with a Name and an Amount
JSON()stringExactly the makePayment object, compact, in this key order: amount, miniAppID, merchantRefID, orderID, callBackUrl, hashValue, items (name, amount). Amounts are JSON integers with every digit; slashes, <, >, & and non-ASCII characters are not escaped
MarshalJSON()([]byte, error)JSON(). json.Marshal escapes <, > and & in it; write JSON() to keep the exact text

PaymentFlow ​

A string type, so payment.Flow() == "redirect" works too.

ConstantValueType
FlowRedirectredirectRedirectPayment
FlowFormformFormPayment
FlowQRqrQrPayment
FlowAppappAppPayment
FlowMiniAppmini_appMiniAppPayment

Raw values are decoded JSON: numbers are json.Number, never a float64. Use json.Marshal(payment.Raw) to log them.

Every result type is a plain struct, so you can build one in your own tests, e.g. &myanmarpayments.RedirectPayment{OrderID: "ORDER_1", URL: "https://…"}.