isurindu / webxpay-laravel

WebXpay

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webxpay Laravel

Latest Stable Version Total Downloads License

Installation

You can install the package via composer:

composer require isurindu/webxpay-laravel

In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:

'providers' => [
    // ...
    Isurindu\WebxpayLaravel\WebxpayServiceProvider::class,
];

You can publish config and views

php artisan vendor:publish --provider="Isurindu\WebxpayLaravel\WebxpayServiceProvider"

Usage

in route

Route::get('payment/{ORDER_ID}', 'PaymentController@index');
Route::post('payment/verify', 'PaymentController@verify');

in App/Http/Middleware/VerifyCsrfToken.php

<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        'payment/verify'
    ];
}

in controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Isurindu\WebxpayLaravel\Facades\Webxpay;

class PaymentController extends Controller
{

    public function store(Request $request)
    {

            return Webxpay::redirect([
                'order_id'=>'102',
                'price'=>'100',
                'first_name'=>'isurindu',
                'last_name'=>'prabashwara',
                'email'=>'hello@isurindu.com',
                'contact_number'=>'',
                'address_line_one'=>'',
                'cms'=>'laravel',
                'process_currency'=>'LKR',
                'custom_fields'=>'',
                'city'=>'',
                'state'=>'',
                'postal_code'=>'',
                'country'=>'',
            ]);

    }
    public function verify(Request $request)
    {
        return dd(Webxpay::verify());
    }
}

About

WebXpay


Languages

Language:PHP 99.9%Language:HTML 0.1%