babaly / laravel-paytech
This package helps laravel developers to use paytech payment platform into their website (ecommerce etc.)
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- spatie/laravel-package-tools: ^1.13.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-12-30 01:46:29 UTC
README
Description
This package help laravel developers to use the paytech payment methods created by Intech-group.
Installation
You can install the package via composer:
composer require babaly/laravel-paytech
Add the service provider to config/app.php into providers section
return [ 'providers' => [ ... App\Providers\PaytechServiceProvider::class ] ];
You can publish all tags by running the command
php artisan vendor:publish --provider="Babaly\LaravelPaytech\LaravelPaytechServiceProvider"
--OR--
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-paytech-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laravel-paytech-config"
This is the contents of the published config file:
return [ 'PAYTECH_API_KEY' => '', 'PAYTECH_SECRET_KEY' => '', ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="laravel-paytech-views"
You can publish the services file with:
php artisan vendor:publish --tag="laravel-paytech-services"
You can publish the model file with:
php artisan vendor:publish --tag="laravel-paytech-models"
You can publish the controller file with:
php artisan vendor:publish --tag="laravel-paytech-controllers"
Usage
Copy the API_SECRET_KEY and API_KEY from your paytech account and paste it to the config file with somethings likde this
return [ 'PAYTECH_API_KEY' => '', 'PAYTECH_SECRET_KEY' => '', ];
Run Your application with the artisan command
php artisan serve
After that, visit the payment route to test payment platform
http://127.0.0.1:8000/payment
NB: Make sure that the routes is copied to default route web, else, copied the next line to your route file
use App\Http\Controllers\PaymentController; Route::get('payment', [PaymentController::class, 'index'])->name('payment.index'); Route::post('/checkout', [PaymentController::class, 'payment'])->name('payment.submit'); Route::get('ipn', [PaymentController::class, 'ipn'])->name('paytech-ipn'); Route::get('payment-success/{code}', [PaymentController::class, 'success'])->name('payment.success'); Route::get('payment/{code}/success', [PaymentController::class, 'paymentSuccessView'])->name('payment.success.view'); Route::get('payment-cancel', [PaymentController::class, 'cancel'])->name('paytech.cancel');
A windows like this image will appear if everythings is ok
Click the button to validate the command and you'll be redirected to paytech platform payment
Mode Production
Don't forget to set test mode to false if you're in production. You can disabled to the controller by calling methods setTestMode(false) or enable the live mode with setLiveMode(true).
If you're in test mode, Paytech retrieve just 100xof for any of your transactions amount. See more about transactions to their documentation
See their documentation for more information
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.