dansmaculotte/laravel-omnipay

Omnipay Service Provider for Laravel
2,637 1
Install
composer require dansmaculotte/laravel-omnipay
Latest Version:v4.0.0
PHP:^8.1
License:MIT
Last Updated:Apr 1, 2022
Links: GitHub  ·  Packagist
Maintainer: GaelReyrol

Omnipay in Laravel

Latest Version Total Downloads Build Status Quality Score Code Coverage

This package allows you to work with Omnipay in Laravel.

Installation

Requirements

  • 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"

Usage

$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();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

Related Packages

tbit/laravel-omnipay-gatewayfactory

Small package to resolve Omnipay's breaking changes when calling GatewayFactory:...

91 0
mayoz/laravel-omnipay

An Omnipay bridge for Laravel 5.

97 1
ignited/laravel-omnipay

Integrates Omnipay with Laravel and provides an easy configuration.

1,142,926 515

Version History

Version Released PHP Laravel License
v4.0.0 ^8.1 ^9.0 MIT
v3.0.0 ^7.4 ^7.0||^8.0 MIT
2.0.0 ^7.2 ^6.0||^7.0 MIT
1.0.0 ^7.2 ^5.8|^6.0 MIT