dbhosale/indipay

Laravel 5 印度支付网关包。目前支持的网关:CCAvenue、PayUMoney、EBS、CitrusPay、InstaMojo

v1.1.2 2017-09-06 05:12 UTC

README

Laravel 5 印度支付网关包。目前支持的网关: CCAvenuePayUMoneyEBSCitrusPay

点击此处获取 Laravel 4.2 包

安装

步骤 1: 使用 composer 安装包

    composer require dbhosale/indipay

步骤 2: 将服务提供者添加到 Laravel 的 config/app.php 文件中


    Softon\Indipay\IndipayServiceProvider::class,

步骤 3: 将 Facade 别名添加到 Laravel 的 config/app.php 文件中


    'Indipay' => Softon\Indipay\Facades\Indipay::class,

步骤 4: 在终端运行以发布配置和中间件


    php artisan vendor:publish

步骤 5: 修改 app\Http\Kernel.php 以使用新的中间件。这是为了避免在支付网关的响应 URL 上进行 CSRF 验证。 您可以根据需要调整 config/indipay.php 文件中的路由来禁用网关响应路由上的 CSRF。


    'App\Http\Middleware\VerifyCsrfToken',


    'App\Http\Middleware\VerifyCsrfMiddleware',

用法

编辑 config/indipay.php。设置适当的网关及其参数。然后在您的代码中...

 use Softon\Indipay\Facades\Indipay;  

使用默认网关启动购买请求并重定向:

      /* All Required Parameters by your Gateway */
      
      $parameters = [
      
        'tid' => '1233221223322',
        
        'order_id' => '1232212',
        
        'amount' => '1200.00',
        
      ];
      
      $order = Indipay::prepare($parameters);
      return Indipay::process($order);

使用配置的任何网关启动购买请求并重定向:

      /* All Required Parameters by your Gateway */
      
      $parameters = [
      
        'tid' => '1233221223322',
        
        'order_id' => '1232212',
        
        'amount' => '1200.00',
        
      ];
      
      // gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo
      
      $order = Indipay::gateway('NameOfGateway')->prepare($parameters);
      return Indipay::process($order);

从网关获取响应(将代码添加到在配置文件中设置的重定向 URL。同时,将响应路由添加到 remove_csrf_check 配置项以删除这些路由上的 CSRF 检查。):-

 
    public function response(Request $request)
    
    {
        // For default Gateway
        $response = Indipay::response($request);
        
        // For Otherthan Default Gateway
        $response = Indipay::gateway('NameOfGatewayUsedDuringRequest')->response($request);

        dd($response);
    
    }