1. Go to this page and download the library: Download laravel_payment/telr 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/ */
return [
// The current mode is live|production or test
'test_mode' => env('TELR_TEST_MODE', true),
// The currency of store
'currency' => 'SAR',
// The sale endpoint that receive the params
// @see https://telr.com/support/knowledge-base/hosted-payment-page-integration-guide
'sale' => [
'endpoint' => 'https://secure.telr.com/gateway/order.json',
],
// The hosted payment page use the following params as it explained in the integration guide
// @see https://telr.com/support/knowledge-base/hosted-payment-page-integration-guide/#request-method-and-format
'create' => [
'ivp_method' => "create",
'ivp_store' => env('TELR_STORE_ID', null),
'ivp_authkey' => env('TELR_STORE_AUTH_KEY', null),
'return_auth' => '/handle-payment/success',
'return_can' => '/handle-payment/cancel',
'return_decl' => '/handle-payment/declined',
]
];
$telrManager = new \TelrGateway\TelrManager();
$billingParams = [
'first_name' => 'Moustafa Gouda',
'sur_name' => 'Bafi',
'address_1' => 'Gnaklis',
'address_2' => 'Gnaklis 2',
'city' => 'Alexandria',
'region' => 'San Stefano',
'zip' => '11231',
'country' => 'EG',
'email' => '[email protected]',
];
$currency = 'SAR'; //it is completely optional if this currency is not passed then the currency from config is taken
return $telrManager->pay('ORDER_ID_GOES_HERE', 'TOTAL_AMOUNT', 'DESCRIPTION ...', $billingParams,$currency)->redirect();
$telrManager = new \TelrGateway\TelrManager();
$telrManager->handleTransactionResponse($request);