PHP code example of abdallahmohammed / laravel-telr

1. Go to this page and download the library: Download abdallahmohammed/laravel-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/ */

    

abdallahmohammed / laravel-telr example snippets


'providers' => [
    // ...
    TelrGateway\TelrServiceProvider::class,
];

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' => 'John',
        'sur_name' => 'Doe',
        // optional
        // 'address_1' => '',
        // 'address_2' => '',
        // 'city' => '',
        // 'region' => '',
        // 'zip' => '',
        'country' => 'EG',
        'email' => '[email protected]',
    ];

return $telrManager->pay('ORDER_ID_GOES_HERE', 'TOTAL_AMOUNT', 'DESCRIPTION ...', $billingParams)->redirect();


> - note that if you want to avoid sending billing params while creating token to process the payment its applicable and the `Telr hosted payment page` will 
bash
php artisan vendor:publish --provider="TelrGateway\TelrServiceProvider"
bash
php artisan migrate