Payment Flows
Starting a payment always follows the same pattern: build the gateway's request object, call the gateway, then act on the typed result it returns. Each flow has its own result class with exactly the fields that flow needs.
| Result | What you do | Returned by |
|---|---|---|
RedirectPayment | Redirect the customer to $payment->url | kbzPay()->pwa(), waveMoney()->initiate() |
FormPayment | Redirect to $payment->autoSubmitUrl | ayaPay()->initiate(), cyberSource()->initiate() |
QrPayment | Show the QR to the customer | kbzPay()->qr(), yomaMmqr()->initiate(), yomaMmqr()->renewQr() |
AppPayment | Return the signed payload to your mobile app | kbzPay()->app() |
The customer finishing on the gateway's side is never proof of payment. Fulfill orders from the verified callback or a status check.
Redirect Payments
Here is the flow with the KBZ Pay PWA; Wave Money works the same way with its own payment page.
The gateway hosts its own payment page. Send the customer there.
use Laranex\LaravelMyanmarPayments\Facades\MyanmarPayments;
use Laranex\PhpMyanmarPayments\KbzPay\KbzPayPaymentData;
$payment = MyanmarPayments::kbzPay()->pwa(new KbzPayPaymentData(
orderId: 'ORDER_'.$order->id,
amount: 10000,
callbackUrl: route('payments.kbz.callback'),
));
return redirect()->away($payment->url);$payment->gatewayReference holds the gateway's id for the attempt (KBZ prepay_id, Wave transaction_id).
Form Payments
Here is the flow with AYA Pay; CyberSource works the same way with its hosted checkout.
The gateway expects the customer's browser to POST a signed form. The package hosts a page that renders the form and submits it immediately, so a redirect is enough:
$payment = MyanmarPayments::ayaPay()->initiate($data);
return redirect($payment->autoSubmitUrl);autoSubmitUrl is an encrypted, expiring link to the package's myanmar-payments.form route. See Configuration.
To render the form yourself, for example with your own loading state, return toHtml() or use action, fields and enctype:
return response($payment->toHtml());<form id="payment-form" method="POST" action="{{ $payment->action }}"
enctype="{{ $payment->enctype }}">
@foreach ($payment->fields as $name => $value)
<input type="hidden" name="{{ $name }}" value="{{ $value }}">
@endforeach
</form>
<script>document.getElementById('payment-form').submit();</script>Post the fields unchanged: they are signed. fields is an array keyed by name, in signing order; $payment->values() returns it and $payment->field($name) reads one.
QR Payments
Here is the flow with Yoma MMQR, whose QR expires after 120 seconds; a KBZ Pay QR follows the same steps without renewals.
Gateways return QR codes in two shapes:
| Property | Gateway | Use it as |
|---|---|---|
qrString | KBZ Pay | A payload: encode it into a QR image with any QR library |
qrImage | Yoma MMQR | A base64 image: display it as is, e.g. with qrImageDataUri() |
$payment = MyanmarPayments::yomaMmqr()->initiate($data);<img src="{{ $payment->qrImageDataUri() }}" alt="Scan to pay">
<p>Valid until {{ $payment->expiresAt?->format('H:i:s') }}</p>expiresAt is set when the gateway limits how long the QR is payable, and reference holds the id used for status checks (Yoma refLabel).
App Payments
Here is the flow with the KBZ Pay mobile SDK.
The KBZ Pay mobile SDK needs a signed order string. Return it to your app, which passes it to KBZPay.startPay():
$payment = MyanmarPayments::kbzPay()->app($data);
// orderId, orderInfo, sign, signType
return response()->json($payment->toArray());The SDK's own result only means the payment screen closed; rely on the callback or kbzPay()->status().
See Results for every property.