LaravelPackages.net
Acme Inc.
Toggle sidebar
mtgofa/laravel-paytabs

Laravel Paytabs

61
1
v2.0.1
About mtgofa/laravel-paytabs

mtgofa/laravel-paytabs is a Laravel package for laravel paytabs. It currently has 1 GitHub stars and 61 downloads on Packagist (latest version v2.0.1). Install it with composer require mtgofa/laravel-paytabs. Discover more Laravel packages by mtgofa or browse all Laravel packages to compare alternatives.

Last updated

Laravel Paytabs

Installation

Begin by installing this package through Composer. Just run following command to terminal-

composer require mtgofa/laravel-paytabs

Once this operation completes the package will automatically be discovered for Laravel 5.6 and above, otherwise, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array.

'providers' => [
	...
	MTGofa\Paytabs\PaytabsServiceProvider::class,
],

Now add the alias.

'aliases' => [
	...
	'Paytabs' => MTGofa\Paytabs\Facades\PaytabsFacade::class,
],

Don't forget to add your paytabs credentials into your .env file.

php artisan vendor:publish --provider="MTGofa\Paytabs\PaytabsServiceProvider"

Then fill in the credentials in config/mtgofa-paytabs.php file if you want instaed of env.

PAYTABS_PROFILE_ID=2****
PAYTABS_SERVER_KEY=S6****6D2J-J2Z****H6K-6T2****MW
PAYTABS_CHECKOUT_LANG=en
PAYTABS_CURRENCY=EGP

VERIFY_ROUTE_NAME=payment.verify

Example:

Create Payment Page:

Route::get('payment/paytabs',  function () {
	$user = auth()->user();
	$result = Paytabs::pay(10.00, $user->id, $user->name, $user->email, $user->phone, [
		'customer_details' => [
			'country' => 'EG',
			'state' => 'C'
		]
	]);
	return $result;
});

Verify Payment:

Route::get('payment/verify/{ref}',  function ($ref) {
	$result = Paytabs::verify($ref);
	return $result;
});
you will need to exclude your paytabs_response route from CSRF protection

Comments