• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

barryvdh/laravel-omnipay: Omnipay ServiceProvider for Laravel

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

barryvdh/laravel-omnipay

开源软件地址(OpenSource Url):

https://github.com/barryvdh/laravel-omnipay

开源编程语言(OpenSource Language):

PHP 100.0%

开源软件介绍(OpenSource Introduction):

Omnipay for Laravel

This is a package to integrate Omnipay with Laravel. You can use it to easily manage your configuration, and use the Facade to provide shortcuts to your gateway.

Installation

Require this package with composer.

$ composer require barryvdh/laravel-omnipay

Pre Laravel 5.5: After updating composer, add the ServiceProvider to the providers array in config/app.php

'Barryvdh\Omnipay\ServiceProvider',

You need to publish the config for this package. A sample configuration is provided. The defaults will be merged with gateway specific configuration.

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

To use the Facade (Omnipay::purchase() instead of App::make(omnipay)->purchase()), add that to the facades array.

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

When calling the Omnipay facade/instance, it will create the default gateway, based on the configuration. You can change the default gateway by calling Omnipay::setDefaultGateway('My\Gateway'). You can get a different gateway by calling Omnipay::gateway('My\Cass')

Examples

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

Besides the gateway calls, there is also a shortcut for the creditcard:

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

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap