gopal-g / payment
Laravel 5.3 Package for Integration of Latest CCAvenue Payment Gateway for PHP 7.1 (Released recently)
Installs: 3 402
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 6
Forks: 9
Open Issues: 1
Requires
- php: >=7.0
- illuminate/support: ~5.0|~6.0
Requires (Dev)
- phpunit/phpunit: >=5.4.3
- squizlabs/php_codesniffer: ^2.3
This package is not auto-updated.
Last update: 2024-11-10 05:29:59 UTC
README
CCAvenue Payment Gateway integration for Laravel 5.x (Supports PHP 7.1)
This package is built to integrate CCAvenue payment gateway into your laravel project, It is developed keeping in mind other payment gateways also but is limited to ccavenue for at the time of release.
Important
The code is originially a fork of similar package by softon/indipay. But this package uses the latest SDK released by CCAvenue for php 7.1
Since their old SDK didn't support that version.
Installation
Step 1: Install package using composer
$ composer require gopal-g/payment
Step 2: Add the service provider to the config/app.php
file in Laravel
Appnings\Payment\PaymentServiceProvider::class,
Step 3: Add an alias for the Facade to the config/app.php
file in Laravel
'Payment' => Appnings\Payment\Facades\Payment::class
Step 4: Publish the Config, Middleware & Views by running in your terminal
php artisan vendor:publish
This above step creates
config/payment.php
app/Http/Middlewares/VerifyCsrfToken.php
resources/views/vendor/payment/ccavenue.blade.php
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/payment.php
to disable CSRF on your gateways response routes.
'App\Http\Middleware\VerifyCsrfToken',
to
'App\Http\Middleware\VerifyCsrfMiddleware',
Usage
Edit the config/payment.php
. Set the appropriate Gateway and its parameters. Then in your code...
use Appnings\Payment\Facades\Payment;
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 = Payment::prepare($parameters); return Payment::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 / others $order = Payment::gateway('NameOfGateway')->prepare($parameters); return Payment::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 = Payment::response($request);
// For Otherthan Default Gateway
$response = Payment::gateway('NameOfGatewayUsedDuringRequest')->response($request);
dd($response);
}
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email c4gopal@gmail.com
instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.