1. Go to this page and download the library: Download isurindu/webxpay-laravel 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/ */
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'payment/verify'
];
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Isurindu\WebxpayLaravel\Facades\Webxpay;
class PaymentController extends Controller
{
public function store(Request $request)
{
return Webxpay::redirect([
'order_id'=>'102',
'price'=>'100',
'first_name'=>'isurindu',
'last_name'=>'prabashwara',
'email'=>'[email protected]',
'contact_number'=>'',
'address_line_one'=>'',
'cms'=>'laravel',
'process_currency'=>'LKR',
'custom_fields'=>'',
'city'=>'',
'state'=>'',
'postal_code'=>'',
'country'=>'',
]);
}
public function verify(Request $request)
{
return dd(Webxpay::verify());
}
}