PHPackages                             lab404/laravel-stripe-server - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. lab404/laravel-stripe-server

ActiveLibrary[Payment Processing](/categories/payments)

lab404/laravel-stripe-server
============================

Laravel Stripe Server is a library to handle Stripe SCA checkout.

1.2.0(5y ago)1547MITPHPPHP ^7.2CI failing

Since Jun 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/404labfr/laravel-stripe-server)[ Packagist](https://packagist.org/packages/lab404/laravel-stripe-server)[ RSS](/packages/lab404-laravel-stripe-server/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (13)Used By (0)

Laravel Stripe Server
=====================

[](#laravel-stripe-server)

Laravel Stripe Server is a library to handle Stripe SCA checkout for your models.

- [Requirements](#requirements)
- [Intended workflow](#intended-workflow)
- [Installation](#installation)
- [Going deeper](#going-deeper)
- [Nova](#nova)
- [Ideas](#ideas)
- [Tests](#tests)
- [Contribute](#contribute)
- [Licence](#licence)

Requirements
------------

[](#requirements)

- Laravel 6.x or 7.x
- PHP &gt;= 7.2

### Laravel support

[](#laravel-support)

VersionRelease6.x, 7.x1.16.x1.05.80.3Intended workflow
-----------------

[](#intended-workflow)

- You have an `Order` model with a stripe checkout. You create the order in your controller.

Example model:

```
use App\Models\Order;
use Lab404\StripeServer\Facades\Stripe;
use Illuminate\Http\Request;

class OrderController
{
    public function store(Request $request)
    {
        // Create your order
        $order = new Order($request->validated());
        $order->save();

        // Create your checkout session
        $session = Stripe::requestCreateSession()
                    ->setCustomerEmail($request->user()->email)
                    ->setReturnUrls($confirm_url, $cancel_url)
                    ->setProduct('T-shirt', 5000, 'EUR', 1, $picture_url)
                    ->call();

        // Create your checkout model
        $checkout = Stripe::registerCheckout($session, $order);

        return Stripe::redirectSession($response->id);
    }
}
```

- Your user is redirected to stripe, he fills his informations and he's redirected to your success URL. The order is not paid yet. Asynchronously, the plugin will try to get new events from Stripe and will dispatch the `CheckoutSessionCompleted` event:

Example listener:

```
use Lab404\StripeServer\Events\CheckoutSessionCompleted;
use Lab404\StripeServer\Models\StripeCheckout;

class CheckoutListener
{
    public function handle(CheckoutSessionCompleted $event): void
    {
        /** @var StripeCheckout $checkout */
        $checkout = $event->checkout;
        /** Your charged model */
        $chargeable = $checkout->chargeable;
        /** The PaymentIntent returned by Stripe */
        $payment = $event->paymentIntent;

        /** Important! Mark the checkout as paid */
        $checkout->markAsPaid();
    }
}
```

- You can use your model like this:

```
$order = Order::with('checkout')->first();
if ($order->checkout->is_paid) {
    echo 'Order is paid';
} else {
    echo 'Order is not paid';
}
```

Installation
------------

[](#installation)

1. Require it with Composer:

```
composer require lab404/laravel-stripe-server
```

2. Configure your Stripe keys in `config/services.php`.
3. Publish `migrations` and `views` with `php artisan vendor:publish --tag=stripe-server`.
4. Migrate `2019_06_19_101000_create_stripe_checkouts_table.php`.
5. Schedule the command in `app\Console\Kernel.php`:

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('stripe:checkout-session-completed')->everyMinute();
}
```

6. Add the `Lab404\StripeServer\Models\HasStripeCheckout` or `HasStripeCheckouts` (if a model can have multiple checkouts) to your chargeable models.

Going deeper
------------

[](#going-deeper)

### Stripe documentation

[](#stripe-documentation)

- [Checkout Server Quickstart](https://stripe.com/docs/payments/checkout/server)
- [Checkout Purchase Fulfillment](https://stripe.com/docs/payments/checkout/fulfillment)
- [Going Live with Checkout](https://stripe.com/docs/payments/checkout/live)
- [Strong Customer Authentication](https://stripe.com/docs/strong-customer-authentication)

### Access the Stripe Manager

[](#access-the-stripe-manager)

With facade:

```
Stripe::method();
```

With DI:

```
public function index(Lab404\StripeServer\Stripe $stripe)
{
    $stripe->method();
}

```

With container:

```
app('stripe')->method();

```

### Available methods

[](#available-methods)

- `redirectSession(string $session_id): Illuminate\Contracts\View\View`
- `registerCheckout(\Stripe\Checkout\Session $session, Model $model): Illuminate\Database\Eloquent\Model`
- `requestCreateCharge(): StripeServer\Requests\CreateCharge`
- `requestCreateSession(): StripeServer\Requests\CreateSession`
- `requestPaymentIntent(string $id): StripeServer\Requests\PaymentIntent`
- `requestEvents(string $type, int $hours = 24): StripeServer\Requests\Events`
- `requestSessionCheckoutCompletedEvents(int $hours = 24): StripeServer\Requests\Events`

### Working with your models

[](#working-with-your-models)

#### Model with many checkouts

[](#model-with-many-checkouts)

When a model has the `Lab404\StripeServer\Models\HasStripeCheckouts` you have access to the following methods and scopes:

```
// Scopes
Model::hasCheckouts()->get();
Model::hasPaidCheckouts()->get();
Model::hasUnpaidCheckouts()->get();

// Methods
$models->checkouts(); // returns all checkout for the model

// Eager loading
$models = Model::with('checkouts')->get();
```

#### Model with one checkout

[](#model-with-one-checkout)

When a model has the `Lab404\StripeServer\Models\HasStripeCheckout` you have access to the following methods and scopes:

```
// Scopes
Model::hasCheckout()->get();
Model::hasPaidCheckout()->get();
Model::hasUnpaidCheckout()->get();

// Methods
$models->checkout(); // returns the checkout for the model

// Eager loading
$models = Model::with('checkout')->get();
```

### Customize the `StripeCheckout` model

[](#customize-the-stripecheckout-model)

Configure `model` in `config/stripe-server.php`. Your custom model should extend the default one.

### Customize the redirector

[](#customize-the-redirector)

When you use the `redirectSession()` method, an instance of `Illuminate\View\View` is returned. You can do:

```
return Stripe::redirectSession('...')->with([
    'title' => 'My custom title',
    'message' => 'My customer redirect message'
]);
```

### Artisan commands

[](#artisan-commands)

#### `stripe:checkout-session-completed`

[](#stripecheckout-session-completed)

Get all `checkout.session.completed` Stripe events and dispatch the event `CheckoutSessionCompleted` for each with the `succeeded` status.

#### `stripe:events`

[](#stripeevents)

Get all Stripe events and dispatch `StripeEvent` for each one.

#### `stripe:purge`

[](#stripepurge)

Delete all unpaid `StripeCheckout` older than the given days. Customize with the `--days` option, defaults to 7. It's convenient to call it in a scheduler:

```
$schedule->command('stripe:purge')->dailyAt('12:00');

```

Nova
----

[](#nova)

If you're using [Laravel Nova](https://nova.laravel.com) you can add the `Lab404\StripeServer\Nova\StripeCheckout` resource:

```
Laravel\Nova\Nova::resources([
    Lab404\StripeServer\Nova\StripeCheckout::class,
]);

```

This resource is not dynamically registered because it's quite simple and you may want to override it. More Nova features like Refund Action or Cards are coming.

TODOs and ideas
---------------

[](#todos-and-ideas)

\[x\] Purge unpaid stripe checkouts
\[ \] Refund
\[ \] Nova actions

Tests
-----

[](#tests)

TODO

Contribute
----------

[](#contribute)

This package is still in development, feel free to contribute!

### Contributors

[](#contributors)

- [MarceauKa](https://github.com/MarceauKa)
- and all others [contributors](https://github.com/404labfr/laravel-impersonate/graphs/contributors)

Licence
-------

[](#licence)

MIT

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~96 days

Total

12

Last Release

2127d ago

Major Versions

0.3.2 → 1.0.02019-09-05

PHP version history (2 changes)0.0.1PHP ^7.1.3

1.0.0PHP ^7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1665333?v=4)[Marceau Casals](/maintainers/MarceauKa)[@MarceauKa](https://github.com/MarceauKa)

---

Top Contributors

[![MarceauKa](https://avatars.githubusercontent.com/u/1665333?v=4)](https://github.com/MarceauKa "MarceauKa (26 commits)")

---

Tags

checkoutlaravellaravel-packagestripepluginlaravelpackagestripeserverlaravel-packagelaravel-pluginpaymentcheckoutsca

### Embed Badge

![Health badge](/badges/lab404-laravel-stripe-server/health.svg)

```
[![Health](https://phpackages.com/badges/lab404-laravel-stripe-server/health.svg)](https://phpackages.com/packages/lab404-laravel-stripe-server)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k16.4M48](/packages/lab404-laravel-impersonate)[lab404/laravel-auth-checker

Laravel Auth Checker allows you to log users authentication, devices authenticated from and lock intrusions.

223164.9k2](/packages/lab404-laravel-auth-checker)[rickycezar/laravel-jwt-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

24117.6k](/packages/rickycezar-laravel-jwt-impersonate)[payum/stripe

The Payum extension. It provides Stripe payment integration.

22573.1k3](/packages/payum-stripe)[flux-se/sylius-stripe-plugin

Sylius Stripe plugin using Payment Request

1029.3k](/packages/flux-se-sylius-stripe-plugin)[hapidjus/laravel-impersonate-ui

UI for 404labfr/laravel-impersonate

371.5k](/packages/hapidjus-laravel-impersonate-ui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
