The Laravel 5 Package for Indian Payment Gateways. Currently supported gateway: CCAvenue, PayUMoney, EBS, CitrusPay ,ZapakPay (Mobikwik), Mocker
Step 1: Install package using composer
composer require rajagonda/gondapay
Step 2: Add the service provider to the config/app.php file in Laravel (Optional for Laravel 5.5)
Rajagonda\Gondapay\GondapayServiceProvider::class,
Step 3: Add an alias for the Facade to the config/app.php file in Laravel (Optional for Laravel 5.5)
'Gondapay' => Rajagonda\Gondapay\Facades\Gondapay::class,
Step 4: Publish the config & Middleware by running in your terminal
php artisan vendor:publish
Step 5: Modify the app\Http\Kernel.php to use the new Middleware. This is required so as to avoid CSRF verification on the Response Url from the payment gateways. You may adjust the routes in the config file config/gondapay.php to disable CSRF on your gateways response routes.
App\Http\Middleware\VerifyCsrfToken::class,
to
App\Http\Middleware\VerifyCsrfMiddleware::class,
Edit the config/gondapay.php. Set the appropriate Gateway and its parameters. Then in your code...
use Rajagonda\Gondapay\Facades\Gondapay;
Initiate Purchase Request and Redirect using the default gateway:-
/* All Required Parameters by your Gateway */
$parameters = [
'tid' => '1233221223322',
'order_id' => '1232212',
'amount' => '1200.00',
];
$order = Gondapay::prepare($parameters);
return Gondapay::process($order);
Initiate Purchase Request and Redirect using any of the configured gateway:-
/* All Required Parameters by your Gateway */
$parameters = [
'tid' => '1233221223322',
'order_id' => '1232212',
'amount' => '1200.00',
];
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
$order = Gondapay::gateway('NameOfGateway')->prepare($parameters);
return Gondapay::process($order);
Get the Response from the Gateway (Add the Code to the Redirect Url Set in the config file. Also add the response route to the remove_csrf_check config item to remove CSRF check on these routes.):-
public function response(Request $request)
{
// For default Gateway
$response = Gondapay::response($request);
// For Otherthan Default Gateway
$response = Gondapay::gateway('NameOfGatewayUsedDuringRequest')->response($request);
dd($response);
}