This package allows you to work with Omnipay in Laravel.
- PHP 7.4
You can install the package via composer:
composer require dansmaculotte/laravel-omnipay
The package will automatically register itself.
To publish the config file to config/omnipay.php run:
php artisan vendor:publish --provider="DansMaCulotte\Omnipay\OmnipayServiceProvider"
$params = [
'amount' => $order->amount,
'issuer' => $issuerId,
'description' => $order->description,
'returnUrl' => URL::action('PurchaseController@return', [$order->id]),
];
$response = Omnipay::purchase($params)->send();
if ($response->isRedirect()) {
// redirect to offsite payment gateway
return $response->getRedirectResponse();
}
if ($response->isSuccessful() === false) {
// payment failed: display message to customer
echo $response->getMessage();
}
// payment was successful: update database
print_r($response);
You can change default gateway with :
OmnipayFacade::setDefaultGateway('Stripe');
Or temporary change gateway :
Omnipay::withGateway('Dummy')->purchase($params)->send();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.