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 / Method | Type | Description |
|---|---|---|
Flow() | PaymentFlow | FlowRedirect |
OrderID | string | Your order ID, as sent to the gateway |
URL | string | The gateway page to redirect the customer to |
GatewayReference | string | The gateway's ID for this attempt (KBZ prepay_id, Wave transaction_id) |
Raw | map[string]any | The gateway's response, for logging |
FormPayment
Returned by aya.Initiate() and cs.HostedCheckout().
| Field / Method | Type | Description |
|---|---|---|
Flow() | PaymentFlow | FlowForm |
OrderID | string | Your order ID |
Action | string | The gateway URL the form posts to |
Fields | []FormField | The signed hidden fields in order. Post them unchanged |
Enctype | string | The encoding the gateway expects: multipart/form-data (AYA) or application/x-www-form-urlencoded (CyberSource) |
HTML() | string | A complete page that submits the form on load. Every value is HTML-escaped (" as ", ' as ') |
HTMLWithNonce(nonce) | string | The 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]string | The 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 / Method | Type | Description |
|---|---|---|
Flow() | PaymentFlow | FlowQR |
OrderID | string | Your order ID |
QRString | string | A QR payload to encode yourself (KBZ Pay) |
QRImage | string | A base64 image to display as is (Yoma MMQR) |
ExpiresAt | time.Time | When the QR stops being payable: now + the time to live (KBZ Pay) or QRLifetime, 120 seconds (Yoma MMQR) |
Reference | string | The gateway's ID for this QR, used for status checks (Yoma refLabel, KBZ prepay_id) |
Raw | map[string]any | The gateway's response, for logging |
QRImageDataURI(mimeType) | string | QRImage 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 / Method | Type | Description |
|---|---|---|
Flow() | PaymentFlow | FlowApp |
OrderID | string | Your order ID |
OrderInfo | string | The signed order string the SDK expects |
Sign | string | The signature of OrderInfo |
SignType | string | The signature algorithm, SHA256 |
Raw | map[string]any | The 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 / Method | Type | Description |
|---|---|---|
Flow() | PaymentFlow | FlowMiniApp |
OrderID | string | Your order ID (orderID) |
Amount | Amount | The signed total, in whole kyat |
MiniAppID | string | The configured mini app ID (miniAppID) |
MerchantReferenceID | string | Your ID for this attempt (merchantRefID) |
CallbackURL | string | The signed callback URL (callBackUrl) |
HashValue | string | The payload's hash (hashValue) |
Items | []MiniAppItem | The line items, each with a Name and an Amount |
JSON() | string | Exactly 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.
| Constant | Value | Type |
|---|---|---|
FlowRedirect | redirect | RedirectPayment |
FlowForm | form | FormPayment |
FlowQR | qr | QrPayment |
FlowApp | app | AppPayment |
FlowMiniApp | mini_app | MiniAppPayment |
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://…"}.