isurindu / webxpay-laravel
Webxpay laravel package
v1.4
2018-07-02 09:56 UTC
This package is not auto-updated.
Last update: 2025-01-21 02:33:38 UTC
README
Installation
You can install the package via composer:
composer require isurindu/webxpay-laravel
In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php
file:
'providers' => [ // ... Isurindu\WebxpayLaravel\WebxpayServiceProvider::class, ];
You can publish config and views
php artisan vendor:publish --provider="Isurindu\WebxpayLaravel\WebxpayServiceProvider"
Usage
in route
Route::get('payment/{ORDER_ID}', 'PaymentController@index'); Route::post('payment/verify', 'PaymentController@verify');
in App/Http/Middleware/VerifyCsrfToken.php
<?php 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' ]; }
in controller
<?php 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'=>'hello@isurindu.com', '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()); } }