PHP code example of mcire / paytech

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

    

mcire / paytech example snippets


'providers' => [
    // ...
    Mcire\PayTech\PayTechServiceProvider::class,
],

'aliases' => [
    // ...
    'PayTech' => Mcire\PayTech\Facades\PayTech::class,
],

use Mcire\PayTech\Facades\PayTech;

try {
    $response = PayTech::requestPayment([
        'item_name' => 'Product name',
        'item_price' => 1000, // Price in cents
        'currency' => 'XOF',
        'ref_command' => Str::random(12), // Unique reference
        'command_name' => 'Order description',
    ]);
    
    // Redirect to PayTech payment page
    return redirect($response['redirect_url']);
} catch (\Exception $e) {
    // Error handling
    abort(500, $e->getMessage());
}
bash
php artisan vendor:publish --tag=config
bash
php artisan serve