Fawry is a Laravel package for the Fawry payment gateway (EGYPT).
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"
- 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("[email protected]")
->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");
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please review our security policy on how to report security vulnerabilities.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.