PHP code example of isurindu / webxpay-laravel

1. Go to this page and download the library: Download isurindu/webxpay-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

isurindu / webxpay-laravel example snippets


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

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



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'
    ];
}



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'=>'[email protected]',
                '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());
    }
}
bash
php artisan vendor:publish --provider="Isurindu\WebxpayLaravel\WebxpayServiceProvider"