Skip to content

Wave Money

wave_money uses the redirect-based flow.

Initiating a Payment

php
use Illuminate\Support\Str;
use Laranex\LaravelMyanmarPayments\Data\Request\WaveMoneyRequestPaymentData;
use Laranex\LaravelMyanmarPayments\MyanmarPaymentsFacade as MyanmarPayments;

$orderId = Str::uuid()->toString();

$data = new WaveMoneyRequestPaymentData(
    orderId:              $orderId,
    backendResultUrl:     route('payment.callback'),
    frontendResultUrl:    route('payment.success'),
    description:          'Order payment',
    items: [
        ['name' => 'Product A', 'amount' => 3000],
        ['name' => 'Product B', 'amount' => 2000],
    ],
    amount:               5000,       // optional — defaults to sum of items
    merchantReferenceId:  $orderId,   // optional — defaults to orderId
);

$result = MyanmarPayments::driver('wave_money')->initiate($data);

return redirect($result->value);

Parameters

ParameterTypeRequiredDescription
orderIdstringYesYour unique order identifier
backendResultUrlstringYesURL Wave Money posts the callback to
frontendResultUrlstringYesURL Wave Money redirects the customer to after payment
descriptionstringYesPayment description shown to the customer
itemsarrayYesLine items — each must have name (string) and amount (int, MMK)
amountintNoTotal charge in MMK. Defaults to the sum of all item amounts
merchantReferenceIdstringNoYour internal reference. Defaults to orderId

Handling Callbacks

php
Route::post('/payment/callback/wave-money', function (Request $request) {
    $result = MyanmarPayments::driver('wave_money')->handleCallback($request->all());

    if ($result->successful) {
        // $result->transactionId — the orderId echoed back in the callback
    }
});

Callback statuses

Wave Money status$result->successful
PAYMENT_CONFIRMEDtrue
PAYMENT_FAILEDfalse
TRANSACTION_TIMED_OUTfalse
SCHEDULER_TRANSACTION_TIMED_OUTfalse