PHP code example of david-maximous / fawrypay

1. Go to this page and download the library: Download david-maximous/fawrypay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

david-maximous / fawrypay example snippets



return [
    'FAWRY_URL' => env('FAWRY_URL', "https://atfawry.fawrystaging.com/"), //https://www.atfawry.com/ for production
    'FAWRY_SECRET' => env('FAWRY_SECRET'),
    'FAWRY_MERCHANT' => env('FAWRY_MERCHANT'),

    'VERIFY_ROUTE_NAME' => "verify-payment", //Route name for the payment verify route
    'APP_NAME'=>env('APP_NAME'),
];

Route::get('/payments/verify/{payment?}',[PaymentController::class,'payment_verify'])->name('verify-payment'); //Should redirect a user to a pending/confirmation page after finishing the payment
Route::post('/payments/Callback',[PaymentController::class,'verifyCallback'])->name('verify-payment-callback'); //This route should be provided to Fawry in order to use it as your notification endpoint

Route::get('/payments/verify/{payment?}',[PaymentController::class,'payment_verify'])->name('verify-payment'); //In this case the user should be redirected to a verify function that calls the verify function mentioned above