PHP code example of yousef / payment-gateway

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

    

yousef / payment-gateway example snippets



return [
    // ...
    
    'providers' => [
        Yousef\PaymentGateway\PaymentGatewayServiceProvider::class,
        
    ];

    // ...
];



    Payment::createSession($amount, $transactionId, $currency);
    
    Payment::pay($transactionId);
    


return [
    ...,
    'KWD' => [
        'certificate_verify_peer' => env('CERTIFICATE_VERIFY_PEER', false),
        'certificate_verify_host' => env('CERTIFICATE_VERIFY_HOST', 0),
        'gateway_url' => env('GATEWAY_URL', ''),
        'username'=> env('MERCHANT_USERNAME_KWD', ''),
        'merchant_id' => env('MERCHANT_ID_KWD', 0),
        'password'=> env('MERCHANT_PASSWORD_KWD', ''),
        'merchant_email' => env('MERCHANT_EMAIL_KWD', 0),
        'debug' => env('DEBUG', false),
        'version' => env('VERSION', 61),

        'operations' => [
            'new_session' => 'CREATE_CHECKOUT_SESSION',
            'retrieve_order' => 'RETRIEVE_ORDER',
        ]
    ],
 
    NotCaptured::class
    InvalidAmount::class  
    InvalidTransactionId::class

VERSION=""
GATEWAY_URL=""

MERCHANT_ID_USD=""
MERCHANT_EMAIL_USD=""
MERCHANT_USERNAME_USD=""
MERCHANT_PASSWORD_USD=""

MERCHANT_ID_KWD=""
MERCHANT_EMAIL_KWD=""
MERCHANT_USERNAME_KWD=""
MERCHANT_PASSWORD_KWD=""
shell
php artisan vendor:publish