1. Go to this page and download the library: Download zakariatlilani/payfort 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/ */
zakariatlilani / payfort example snippets
'payfort' => [
/**
* Routing return URLs, on success || failure
*/
'callback_urls' => [
'error-page' => '/api/error', // redirect to error page
'success-page' => '/api/success', // redirect to success page
],
/**
* Account specific settings (you are going to get from you Payfort account)
*/
'sandboxMode' => env('PAYFORT_SAND_BOX_MODE', true),
'merchantIdentifier' => env('MERCHANT_IDENTIFIER', ''),
'accessCode' => env('ACCESS_CODE', ''),
'SHARequestPhrase' => env('SHA_REQUEST_PASSPHRASE', ''),
'SHAResponsePhrase' => env('SHA_RESPONSE_PASSPHRASE', ''),
'SHAType' => env('SHA_TYPE', 'sha256'),
'command' => env('COMMAND', 'AUTHORIZATION'),
/**
* General usage settings
*/
'language' => env('LANGUAGE', 'en'), // used currency ex: english
'currency' => env('CURRENCY', 'SAR') // used currency ex: saudi arabian riyal
]
'payfort_apple_pay' => [
'sandboxMode' => env('PAYFORT_SAND_BOX_MODE', true),
'merchantIdentifier' => env('MERCHANT_IDENTIFIER', ''),
'accessCode' => env('ACCESS_CODE', ''),
'SHARequestPhrase' => env('SHA_REQUEST_PASSPHRASE', ''),
'SHAResponsePhrase' => env('SHA_RESPONSE_PASSPHRASE', ''),
'SHAType' => env('SHA_TYPE', 'sha256'),
'command' => env('COMMAND', 'PURCHASE'),
'language' => env('LANGUAGE', 'en'),
'currency' => env('CURRENCY', 'SAR')
]
use Illuminate\Http\Request;
Route::post('/pay', function (Request $request) {
/**
* you can add to your controller or route to use the gateway.
*/
$payment_type = payfort_apple_pay || payfort // use one of these parameters as a string.
$merchant_reference = Payment::use('payfort')->generateMerchantReference();
return Payfort::use($payment_type, $merchant_reference)->pay();
});