PHP code example of msavchin / laravel-omnipay

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

    

msavchin / laravel-omnipay example snippets


...
'gateways' => [
    'paypal' => [
        'driver'  => 'PayPal_Express',
        'options' => [
            'username'  => 'coolusername',
            'password'  => 'strongpassword',
            'signature' => '',
            'solutionType' => '',
            'landingPage'    => '',
            'headerImageUrl' => '',
            'brandName' =>  'Your app name',
            'testMode' => 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('paypal');

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

dd($response->getMessage());

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

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

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

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