mayoz/laravel-omnipay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mayoz/laravel-omnipay

最新稳定版本:v2.0.1

Composer 安装命令:

composer require mayoz/laravel-omnipay

包简介

An Omnipay bridge for Laravel 5.

README 文档

README

An Omnipay bridge for Laravel 5

Latest Version on Packagist Software License

Install

Via Composer

$ composer require mayoz/laravel-omnipay

Configuration

After installing the Omnipay library, register the Mayoz\Omnipay\OmnipayServiceProvider in your config/app.php configuration file:

    'providers' => [
        // Other service providers...

        Mayoz\Omnipay\OmnipayServiceProvider::class,
    ],

Also, add the Omnipay facade to the aliases array in your app configuration file:

    'Omnipay' => Mayoz\Omnipay\Facades\Omnipay::class,

Finally, publish the configuration files via php artisan vendor:publish.

Open the config/omnipay.php configuration file and set the default provider connection with default key. Define the connections with initialize configurations you want in providers key.

    'providers' => [
        'Stripe' => [
            'ApiKey'   => '',
            'testMode' => false,
        ],

        'Iyzico' => [
            'ApiKey'    => '',
            'ApiSecret' => '',
            'testMode'  => false,
        ]
    ],

Omnipay Driver

This package supports when yours driver has been using the Omnipay infrastructure. Now, add the omnipay provider you want to use. For example:

$ composer require omnipay/stripe
# or
$ composer require mayoz/omnipay-iyzico

Usage

Next, you are ready to use. Please see the following examples.

<?php

    namespace App\Http\Controllers;

    use Omnipay;
    use Illuminate\Routing\Controller;

    class HomeController extends Controller
    {
        /**
         * Purchase.
         *
         * @return Response
         */
        public function purchase()
        {
            // Send purchase request
            $response = Omnipay::purchase([
                'amount' => '10.00',
                'currency' => 'USD',
                'card' => [
                    'number' => '4242424242424242',
                    'expiryMonth' => '6',
                    'expiryYear' => '2016',
                    'cvv' => '123'
                ]
            ])->send();

            // Process response
            if ($response->isSuccessful()) {

                // Payment was successful
                print_r($response);

            } elseif ($response->isRedirect()) {

                // Redirect to offsite payment gateway
                $response->redirect();

            } else {

                // Payment failed
                echo $response->getMessage();
            }
        }
    }

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Security

If you discover any security related issues, please email srcnckr@gmail.com instead of using the issue tracker.

License

THis package is licensed under The MIT License (MIT).

统计信息

  • 总下载量: 97
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-08