Skip to content

Results ​

Starting a payment returns one of four frozen dataclasses exported from python_myanmar_payments. Each has a flow class attribute, and PaymentResult is their union, so a match statement or isinstance check tells them apart. Fields a gateway did not provide are None.

RedirectPayment ​

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

FieldTypeDescription
flowPaymentFlowPaymentFlow.REDIRECT
order_idstrYour order ID, as sent to the gateway
urlstrThe gateway page to redirect the customer to
gateway_referencestr | NoneThe gateway's ID for this attempt (KBZ prepay_id, Wave transaction_id)
rawMapping[str, Any]The gateway's response, for logging

FormPayment ​

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

Field / MethodTypeDescription
flowPaymentFlowPaymentFlow.FORM
order_idstrYour order ID
actionstrThe gateway URL the form posts to
fieldstuple[FormField, ...]The signed hidden fields in order. Post them unchanged
enctypestrThe encoding the gateway expects; application/x-www-form-urlencoded unless the gateway needs another (AYA: multipart/form-data)
to_html()strA complete, escaped page that submits the form on load
field(name)str | NoneOne field's value
values()dict[str, str]The fields as a dict

FormField is a frozen dataclass with name: str and value: str.

QrPayment ​

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

Field / MethodTypeDescription
flowPaymentFlowPaymentFlow.QR
order_idstrYour order ID
qr_stringstr | NoneA QR payload to encode yourself (KBZ Pay)
qr_imagestr | NoneA base64 image to display as is (Yoma MMQR)
expires_atdatetime | NoneWhen the QR stops being payable, as an aware UTC datetime; None when the gateway sets no limit
referencestr | NoneThe gateway's ID for this QR, used for status checks (Yoma refLabel, KBZ prepay_id)
rawMapping[str, Any]The gateway's response, for logging
qr_image_data_uri(mime_type="image/png")str | Noneqr_image as a data URI. None when there is no image

AppPayment ​

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

Field / MethodTypeDescription
flowPaymentFlowPaymentFlow.APP
order_idstrYour order ID
order_infostrThe signed order string the SDK expects
signstrThe signature of order_info
sign_typestrThe signature algorithm, SHA256
rawMapping[str, Any]The gateway's response; left out of to_dict()
to_dict()dict[str, str]{"orderId", "orderInfo", "sign", "signType"}, the values your app needs

PaymentFlow ​

A str enum, so payment.flow == "redirect" works too.

MemberValueClass
PaymentFlow.REDIRECTredirectRedirectPayment
PaymentFlow.FORMformFormPayment
PaymentFlow.QRqrQrPayment
PaymentFlow.APPappAppPayment

raw values are plain Python values: every JSON number is its exact text as a str (1000.50 stays "1000.50"), never a float, so json.dumps(payment.raw) logs them as is.

Every result class takes its fields as keyword arguments, so you can build one in your own tests, e.g. RedirectPayment(order_id="ORDER_1", url="https://…").

Released under the MIT License, except where a package says otherwise.