https://github.com/mariojgt/gateway
Payments gateways for laravel made simple, the aim of this package is integrate most relevants payments gateway in a very simple way.
https://github.com/mariojgt/gateway
cashier easy-to-use gateway gocardless laravel payment payment-gateway paypal-laravel php stripe
Last synced: 5 months ago
JSON representation
Payments gateways for laravel made simple, the aim of this package is integrate most relevants payments gateway in a very simple way.
- Host: GitHub
- URL: https://github.com/mariojgt/gateway
- Owner: mariojgt
- License: mit
- Created: 2020-05-06T16:02:49.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-02-25T23:31:57.000Z (over 2 years ago)
- Last Synced: 2025-01-20T13:20:48.225Z (over 1 year ago)
- Topics: cashier, easy-to-use, gateway, gocardless, laravel, payment, payment-gateway, paypal-laravel, php, stripe
- Language: Blade
- Homepage:
- Size: 1.46 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README

# Laravel Gateway laravel 9 compatible
#composer require mariojgt/gateway
This is a Laravel package design to make checkout easy and clean to implement, avaliable integration (Stripe), in the future we going to have some more integrations with others gateways, the paypal is almost there
## How to use
In you blade file do the following
1. This component will add all the javascript methods so we can generate a session and redirect the user.
2. On you button you need to add this method RegenerateSessionAndRedirect
```html
```
This method will send a request back to your server and generate a key so we can use in the javascript checkout.
3. in the config file you have the key stripe_session_generate you need to point that to one of your laravel controler, you can use get or post for this.
4. Use this example code to generate you session
```php
use Mariojgt\Gateway\Controllers\StripeContoller;
public function sessionGenerate(Request $request)
{
// Start the stripe class
$stipeManager = new StripeContoller();
// Cart example, you Must folow this stucture
$cartItem = [
[
'name' => 'kit kat',
'description' => 'Kit kat product',
'images' => ['https://www.kitkat.com/images/main-logo-snap.png'],
'amount' => 500, // Amount in pence value * 100
'currency' => config('gateway.currency'),
'quantity' => 2,
],
];
// Send the cart item so stripe can create a valid session
$session = $stipeManager->process($cartItem);
// Return a stripe session so we can use in the front end to redirect the user
return response()->json([
'session' => $session->id,
]);
}
```
This code will return a json session that we can use in the javascript
5. You Can also check the session status using
```php
use Mariojgt\Gateway\Controllers\StripeContoller;
$stipeManager = new StripeContoller();
$session = $stipeManager->checkSession('Session_id');
```
This will return the session information and the payment information.
Notes:
In Production disable the website demo buy changing the key value demo_mode to false in the gateway config file.