laravel-pay / fawry
This is my package fawry
dev-master
2023-08-25 07:00 UTC
Requires
- php: ^8.0|^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
This package is not auto-updated.
Last update: 2024-11-20 13:52:43 UTC
README
Fawry is a Laravel package for the Fawry payment gateway (EGYPT).
Contents
Installation
You can install the package via composer:
composer require laravel-pay/fawry
You can publish and run the Translations with:
php artisan vendor:publish --tag="fawry-translations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="fawry-config"
This is the contents of the published config file:
<?php // config for LaravelPay/Fawry return [ "staging" => [ 'url' => env('FAWRY_STAGING_URL', "https://atfawry.fawrystaging.com/"), 'secret' => env('FAWRY_STAGING_SECRET'), 'merchant' => env('FAWRY_STAGING_MERCHANT'), ], "live" => [ 'url' => env('FAWRY_LIVE_URL', "https://www.atfawry.com/"), 'secret' => env('FAWRY_LIVE_SECRET'), 'merchant' => env('FAWRY_LIVE_MERCHANT'), ], // required allowed values [POPUP, INSIDE_PAGE, SIDE_PAGE , SEPARATED] 'display_mode' => env('FAWRY_DISPLAY_MODE',"POPUP"), // allowed values ['CashOnDelivery', 'PayAtFawry', 'MWALLET', 'CARD' , 'VALU'] 'pay_mode'=>env('FAWRY_PAY_MODE',"CARD"), "verify_route_name" => env('FAWRY_VERIFY_ROUTE_NAME', "fawry.verify"), "locale" => env('FAWRY_LOCALE', "ar"), // ar or en "language" => env('FAWRY_LANGUAGE', "ar-eg"), // ar-eg or en-us ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="fawry-views"
Usage
- add this to your .env file
FAWRY_STAGING_MERCHANT="" FAWRY_STAGING_SECRET=""
- Pay Route
Route::get("/fawry" , function(){ $form = Fawry::setOnStagingMode() ->setAmount(100.12) ->setUserId(11111) ->setUserFirstName("ahmed") ->setUserLastName("elsayed") ->setUserEmail("ahmed_elsayed@gmail.com") ->setUserPhone("01000000000") ->pay(); return view("welcome" , [ "form" => $form['html'] ]); });
- Verify Route
note : you can change the verify route name in config file
Route::get("/fawry/verify" , function(){ $response = Fawry::setOnStagingMode()->verify(); dd($response); })->name("fawry.verify");
Changelog
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Security
Please review our security policy on how to report security vulnerabilities.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.