PHP code example of tomato-technologies / tomato-omipay
1. Go to this page and download the library: Download tomato-technologies/tomato-omipay library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomato-technologies / tomato-omipay example snippets
Tomato\OmiPay\ServiceProvider::class,
'TomatoOmiPay' => Tomato\OmiPay\Facade::class,
$qrRequest=new \Tomato\OmiPay\Requests\Payment\QROrderRequest();
$qrRequest->setOrderName("Test Product 1");
$qrRequest->setCurrency("AUD");
$qrRequest->setAmount(1*100);//1 dollar
$qrRequest->setNotifyUrl(route("opmipay-notification"));
$qrRequest->setOutOrderNo("10001");
$qrRequest->setPlatform("ALIPAY");
$result=\TomatoOmiPay::qrOrder($qrRequest);
var_dump($result);
'omipay.got-notification'=>[
'App\Http\Controllers\Site\HomeController@onOmipayNotice'
],
public function onOmipayNotice($data=[]){
\Log::info(json_encode($data));
}
$qrRequest=new \Tomato\OmiPay\Requests\Payment\QROrderRequest();
$qrRequest->setOrderName("Test Product 1");
$qrRequest->setCurrency("AUD");
$qrRequest->setAmount(1*100);//1 dollar
$qrRequest->setNotifyUrl(route("opmipay-notification"));
$qrRequest->setOutOrderNo("10001");
$qrRequest->setPlatform("ALIPAY");
$result=\TomatoOmiPay::qrOrder($qrRequest);
$redirectURL=route("thank-you-page",["order_id"=>10001]);
$directCusomterToURL=data_get($result,"pay_url")."&redirect_url=".urlencode($redirectURL);
$qrRequest=new \Tomato\OmiPay\Requests\Payment\QROrderRequest();
$qrRequest->setOrderName("Test Product 1");
$qrRequest->setCurrency("AUD");
$qrRequest->setAmount(1*100);//1 dollar
$qrRequest->setNotifyUrl(route("opmipay-notification"));
$qrRequest->setRedirectUrl(route("thank-you-page",["order_id"=>10001]))
$qrRequest->setOutOrderNo("10001");
$qrRequest->setPlatform("ALIPAY");
$result=\TomatoOmiPay::qrOrder($qrRequest);
$directCusomterToURL=data_get($result,"pay_url");
cli
php artisan vendor:publish --provider="Tomato\OmiPay\ServiceProvider"