LaravelPackages.net
Acme Inc.
Toggle sidebar
lubem/gladepay

glade payment system for initiating and verifying bank transfer

1
0
About lubem/gladepay

lubem/gladepay is a Laravel package for glade payment system for initiating and verifying bank transfer. It currently has 0 GitHub stars and 1 downloads on Packagist. Install it with composer require lubem/gladepay. Discover more Laravel packages by lubem or browse all Laravel packages to compare alternatives.

Last updated

GladePay

Latest Version on Packagist Total Downloads Build Status StyleCI

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require lubem/gladepay

Or add the following line to the require block of your composer.json file.

"lubem/gladepay": "@dev"

You'll then need to run composer install or composer update to download it and have the autoloader updated.


Skip this step if using Laravel >=5.5 as the service will be registered automatically
Once installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

"providers" => [
		.....
		
        Lubem\GladePay\GladePayServiceProvider::class,
		
		.....
            ],
"aliases" => [
		.....
		
        "GladePay": Lubem\GladePay\Facades\GladePay::class,
		
		.....
            ]

Configuration

You can publish the configuration file using this command:

php artisan vendor:publish --provider="Lubem\GladePay\GladePayServiceProvider"

A configuration file named gladepay.php with some defaults will be placed in your config directory:

<?php

return [
    /*
   |--------------------------------------------------------------------------
   | MERCHANT ID
   |--------------------------------------------------------------------------
   |
   | set the merchant id from environment
   |
   */

    'mid' => env('GLADE_MERCHANT_ID', 'GP0000001'),

    /*
    |--------------------------------------------------------------------------
    | MERCHANT KEY
    |--------------------------------------------------------------------------
    |
    | set the merchant key from environment
    |
    */

    'key' => env('GLADE_MERCHANT_KEY', '123456789'),

    /*
     |--------------------------------------------------------------------------
     | BASE URL
     |--------------------------------------------------------------------------
     |
     | set the base api endpoint from environment
     |
     */

    'endpoint' => env('GLADE_ENDPOINT', 'https://demo.api.gladepay.com'),
];

Usage

Open your .env file and add your glade merchant key, glade merchant id, 
and glade api base (https://api.glade.ng) url like so:
get more information on the endpoint at 

glade developer page


GLADE_MERCHANT_ID=xxxxxxxxxxxxx

GLADE_MERCHANT_KEY=xxxxxxxxxxxxx

GLADE_ENDPOINT=https://api.glade.ng

Set up routes and controller methods like so:

create a controller by through artisan command

$ php artisan make:controller GladePayController

#an example is shown below
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Lubem\GladePay\GladePay;

class GladePayController extends Controller
{
    public function initiate()
    {
        $pay = new GladePay();
        $response = $pay->initiateBankTransfer();
        return $response;
    }
}

#routes
you can include routes in routes/web or routes/api like so:
Route::post('/payment', [\App\Http\Controllers\GladePayController::class, 'initiate'])->name('payment');

if using with routes/api, 
test with POSTMAN by sending a POST request to the url http://127.0.0.1:8000/api/payment with these form keys
amount (required), email (optional), firstname (optional), lastname (optional), business_name (optional)

an example is shown like so:

Postman

if using routes/web an example form is shown

<form method="POST" action="{{ route('payment') }}" accept-charset="UTF-8" class="form-horizontal" role="form">
    <div class="row" style="margin-bottom:40px;">
        <div class="col-md-8 col-md-offset-2">
            
            <input name="email" placeholder="enter email oprional"> {{-- optional --}}
            <input name="firstname" placeholder="enter first name optional"> {{-- optional --}}
            <input name="lastname" placeholder="enter last name optional"> {{-- optional --}}
            <input name="business_name" placeholder="enter business name optional"> {{-- optional --}}
            <input name="amount" placeholder="enter amount required"> {{-- number required --}}
            
            @csrf

            <p>
                <button class="btn btn-success btn-lg btn-block" type="submit" value="Make Payment">
                    <i class="fa fa-plus-circle fa-lg"></i> Make Payment
                </button>
            </p>
        </div>
    </div>
</form>

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

Comments