PHP code example of barryvdh / laravel-omnipay

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

    

barryvdh / laravel-omnipay example snippets


'Barryvdh\Omnipay\ServiceProvider',

'Omnipay' => 'Barryvdh\Omnipay\Facade',

$params = [
    'amount' => $order->amount,
    'issuer' => $issuerId,
    'description' => $order->description,
    'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
];

$response = Omnipay::purchase($params)->send();

if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
} elseif ($response->isRedirect()) {
    // redirect to offsite payment gateway
    return $response->getRedirectResponse();
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

$formInputData = [
    'firstName' => 'Bobby',
    'lastName' => 'Tables',
    'number' => '4111111111111111',
];

$card = Omnipay::CreditCard($formInputData);

$ php artisan vendor:publish --provider=Barryvdh\Omnipay\ServiceProvider