OmiPay for Laravel project

v1.0.0 2018-12-07 07:28 UTC



composer require tomatotech/tomato-omipay

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Laravel 5.5+:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php


If you want to make it easier to access Pusher or Event class, add this to your facades in app.php:

'TomatoOmiPay' => Tomato\OmiPay\Facade::class,


Before usage, please remember to set your OMIPAY_MERCHANT_NO and OMIPAY_MERCHANT_KEY in .env file. The merchant number should be a number with "M", eg. "000034".

If you want to get more config on this wrapper, you can pull a configuration file into your application by running on of the following artisan command:

php artisan vendor:publish --provider="Tomato\OmiPay\ServiceProvider"

Example Coding

Making a QRorder:

    $qrRequest=new \Tomato\OmiPay\Requests\Payment\QROrderRequest();
    $qrRequest->setOrderName("Test Product 1");
    $qrRequest->setAmount(1*100);//1 dollar


Here is what you will see from var_dump($result), then using pay_url to redirect use for payment

array (size=8)
  'order_no' => string 'TR1812060010011263009795' (length=24)
  'qrcode' => string '' (length=46)
  'pay_url' => string '' (length=229)
  'platform' => string 'ALIPAY' (length=6)
  'error_msg' => null
  'msg' => null
  'success' => boolean true
  'return_code' => string 'SUCCESS' (length=7)

Example of How to receive Notification from OmiPay

Only verified request will be fired on this event, so there is not need to check the sign.

Listen in you EventServiceProvider and map it to you own handler.


Here is example handler, $data is an array containing all request data (

    public function onOmipayNotice($data=[]){