PHP code example of eadortsu / laravel-omnipay

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

    

eadortsu / laravel-omnipay example snippets


'providers' => [

	'Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider',

]

	'Omnipay' => 'Ignited\LaravelOmnipay\Facades\OmnipayFacade',

$app->register(Ignited\LaravelOmnipay\LumenOmnipayServiceProvider::class);

$app->configure('laravel-omnipay');

...
'gateways' => [
    'paypal' => [
        'driver'  => 'PayPal_Express',
        'options' => [
            'username'  => env( 'OMNIPAY_PAYPAL_EXPRESS_USERNAME', '' ),
            'password'  => env( 'OMNIPAY_PAYPAL_EXPRESS_PASSWORD', '' ),
            'signature' => env( 'OMNIPAY_PAYPAL_EXPRESS_SIGNATURE', '' ),
            'solutionType' => env( 'OMNIPAY_PAYPAL_EXPRESS_SOLUTION_TYPE', '' ),
            'landingPage'    => env( 'OMNIPAY_PAYPAL_EXPRESS_LANDING_PAGE', '' ),
            'headerImageUrl' => env( 'OMNIPAY_PAYPAL_EXPRESS_HEADER_IMAGE_URL', '' ),
            'brandName' =>  'Your app name',
            'testMode' => env( 'OMNIPAY_PAYPAL_TEST_MODE', true )
        ]
    ],
]
...

$cardInput = [
	'number'      => '4444333322221111',
	'firstName'   => 'MR. WALTER WHITE',
	'expiryMonth' => '03',
	'expiryYear'  => '16',
	'cvv'         => '333',
];

$card = Omnipay::creditCard($cardInput);
$response = Omnipay::purchase([
	'amount'    => '100.00',
	'returnUrl' => 'http://bobjones.com/payment/return',
	'cancelUrl' => 'http://bobjones.com/payment/cancel',
	'card'      => $cardInput
])->send();

dd($response->getMessage());

Omnipay::setGateway('eway');

$response = Omnipay::purchase([
	'amount' => '100.00',
	'card'   => $cardInput
])->send();

dd($response->getMessage());

$gateway = Omnipay::gateway('eway');

php artisan vendor:publish --provider="Ignited\LaravelOmnipay\LaravelOmnipayServiceProvider" --tag=config