Transaction Status Update Notifications
Overview
Momo Suite dispatches a TransactionStatusUpdated event every time a transaction’s status is updated—whether by webhook, manual update, or status check.This allows you to easily listen for transaction status changes and perform custom actions, such as logging, sending emails, or SMS notifications.
How It Works
Event: Rais\MomoSuite\Events\TransactionStatusUpdated
Dispatched: Whenever a transaction’s status is updated by the package.
Payload: The event includes the transaction, the old status, and the new status.
How to Listen for Transaction Status Updates
Create a listener class in your app, for example at app/Listeners/LogTransactionStatusUpdate.php:
Create a Listener
Register the Listener
In your app/Providers/EventServiceProvider.php, add:
Then run:
React to Status Changes
Now, whenever a transaction’s status is updated, your listener will be triggered automatically.You can perform any action you want in the handle method—log, notify, update other systems, etc.
Example Use Cases
Send an email or SMS to the user when their transaction status changes.
Log all status changes for auditing.
Trigger business logic in your own application.
Advanced: Multiple Listeners
You can register multiple listeners for the same event if you want to perform several actions.
Troubleshooting
Make sure your listener is registered in EventServiceProvider.
Check your logs (storage/logs/laravel.log) to confirm the listener is being triggered.
If you use event caching, run php artisan event:cache after making changes.
Summary
Momo Suite makes it easy to react to transaction status changes in a scalable, Laravel-native way.Just listen for the TransactionStatusUpdated event and add your custom logic!
Last updated