PHPackages                             elegantly/laravel-stripe - 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. elegantly/laravel-stripe

ActiveLibrary[Payment Processing](/categories/payments)

elegantly/laravel-stripe
========================

Stripe and Stripe Connect for your Laravel App

v2.4.3(1mo ago)24.4k—6.3%[1 PRs](https://github.com/ElegantEngineeringTech/laravel-stripe/pulls)MITPHPPHP ^8.1CI passing

Since Mar 19Pushed 1w agoCompare

[ Source](https://github.com/ElegantEngineeringTech/laravel-stripe)[ Packagist](https://packagist.org/packages/elegantly/laravel-stripe)[ Docs](https://github.com/ElegantEngineeringTech/laravel-stripe)[ GitHub Sponsors](https://github.com/ElegantEngineeringTech)[ RSS](/packages/elegantly-laravel-stripe/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (28)Versions (27)Used By (0)

Stripe and Stripe Connect Integration for Your Laravel Application
==================================================================

[](#stripe-and-stripe-connect-integration-for-your-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c359a30666d1719254cbaa77ef5e6611e46ef9127909c4a00d6f4e1c46e364c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c6567616e746c792f6c61726176656c2d7374726970652e737667)](https://packagist.org/packages/elegantly/laravel-stripe)[![Total Downloads](https://camo.githubusercontent.com/c3556aad2b6c88afdc7c994dcbd56467cdefefa8515ce1a5cb345947c1d8581d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c6567616e746c792f6c61726176656c2d7374726970652e737667)](https://packagist.org/packages/elegantly/laravel-stripe)[![Tests](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/run-tests.yml)[![Laravel Pint](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/pint.yml/badge.svg)](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/pint.yml)[![PHPStan](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/phpstan.yml/badge.svg)](https://github.com/ElegantEngineeringTech/laravel-stripe/actions/workflows/phpstan.yml)

A simple way to attach Stripe Customer and Account to your Model in Laravel.

- Stripe webhooks ready to use out of the box
- Access Stripe PHP SDK easily

Installation Guide
------------------

[](#installation-guide)

You can install the package via Composer:

```
composer require elegantly/laravel-stripe
```

You can publish the configuration file with:

```
php artisan vendor:publish --tag="stripe-config"
```

This is the content of the published configuration file:

```
use App\Models\User;
use Elegantly\Stripe\Commands\CreateStripeWebhooksCommand;
use Elegantly\Stripe\ModelRepository;

return [

    'models' => [
        'accounts' => [
            User::class,
        ],
        'customers' => [
            User::class,
        ],
        'repository' => ModelRepository::class,
    ],

    'key' => env('STRIPE_KEY'),

    'secret' => env('STRIPE_SECRET'),

    /*
    |--------------------------------------------------------------------------
    | Stripe API version
    |--------------------------------------------------------------------------
    |
    | Leave to null to use the latest API version.
    |
    */
    'version' => env('STRIPE_VERSION'),

    /**
     * This is only used for the CreateStripeWebhooksCommand
     * You can add more webhooks directly from your Stripe Dashboard
     */
    'webhooks' => [
        [
            'url' => '/webhooks/stripe',
            'connect' => false,
            'enabled_events' => [
                ...CreateStripeWebhooksCommand::DEFAULT_WEBHOOKS_EVENTS,
            ],
        ],
    ],

];
```

Usage Examples
--------------

[](#usage-examples)

Creating and retrieving a Stripe Account:

```
$user->createStripeAccount();
$user->getStripeAccount();
```

Creating and retrieving a Stripe Customer:

```
$user->createStripeCustomer();
$user->getStripeCustomer();
```

Model Preparation
-----------------

[](#model-preparation)

### Database Setup

[](#database-setup)

This package relies on columns you need to add to any Model that has a Stripe customer or account. To do so, we provide a migration that will automatically add the required columns to your models. To configure which models are related to Stripe, you must edit the configuration file.

### Adding the Necessary Trait

[](#adding-the-necessary-trait)

Add the `HasStripeCustomer` trait to your Model:

```
class Organization extends Model
{
    use HasStripeCustomer;
    // ...
}
```

### Configuring Models

[](#configuring-models)

By default, the package assumes that your Stripe objects are attached to your User model. If this is not the case, you will need to edit the configuration file like this:

```
'models' => [
    'accounts' => [
        \App\Models\User::class,
    ],
    'customers' => [
        \App\Models\Organization::class,
    ],
    'repository' => ModelRepository::class,
],
```

### Running Migrations

[](#running-migrations)

```
php artisan vendor:publish --tag="stripe-migrations"
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations"
php artisan migrate
```

Webhook Configuration
---------------------

[](#webhook-configuration)

This package comes with the command `stripe:create-webhooks`, which will create and configure webhooks on the Stripe dashboard for you. All you need to do is edit the webhooks and the endpoints you want to enable in the configuration file.

### Editing Configuration

[](#editing-configuration)

For example, you could configure two different webhooks with different routes and endpoints like so:

```
return [

    // Other configurations...

    /**
     * This is only used for the CreateStripeWebhooksCommand.
     * You can add more webhooks directly from your Stripe Dashboard.
     */
    'webhooks' => [
        [
            'url' => '/stripe/webhook/account',
            'connect' => false,
            'enabled_events' => [
                ...CreateStripeWebhooksCommand::DEFAULT_WEBHOOKS_EVENTS,
                'checkout.session.expired',
                'checkout.session.completed',
                'checkout.session.async_payment_succeeded',
                'checkout.session.async_payment_failed',
            ],
        ],
        [
            'url' => '/stripe/webhook/connect',
            'connect' => true,
            'enabled_events' => [
                ...CreateStripeWebhooksCommand::DEFAULT_WEBHOOKS_EVENTS,
            ],
        ],
    ],

];
```

### Running the Command

[](#running-the-command)

Once you are satisfied with the configurations, you just need to run:

```
php artisan stripe:create-webhooks
```

### Activating Webhooks on Stripe

[](#activating-webhooks-on-stripe)

All the webhooks configured by this command are disabled by default to prevent unexpected behavior. When you are ready, activate them from your Stripe Dashboard.

### Listening to Stripe Events in Your Application

[](#listening-to-stripe-events-in-your-application)

Now that Stripe sends webhooks to your app, you can listen to them from `EventServiceProvider`.

This package relies on the great `spatie/laravel-stripe-webhooks` package. You must [follow their documentation](https://github.com/spatie/laravel-stripe-webhooks) to set up your listeners.

### Upgrading Stripe's Webhook version

[](#upgrading-stripes-webhook-version)

Running Tests
-------------

[](#running-tests)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Quentin Gabriele](https://github.com/QuentinGab)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 76.3% 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 ~34 days

Recently: every ~9 days

Total

24

Last Release

55d ago

Major Versions

v0.0.4 → v1.0.02024-03-20

v1.1.0 → v2.0.02024-05-26

PHP version history (2 changes)v0.0.1PHP ^8.2

v0.0.2PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d769563728757858e249f266ac2555f28db5640124df92821ed17d93ee76fc7b?d=identicon)[QuentinGab](/maintainers/QuentinGab)

---

Top Contributors

[![QuentinGab](https://avatars.githubusercontent.com/u/40128136?v=4)](https://github.com/QuentinGab "QuentinGab (74 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (16 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

laravelphpstripelaravelElegantlyLaravel-Stripe

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24857.5k](/packages/vormkracht10-laravel-mails)[elegantly/laravel-invoices

Store invoices safely in your Laravel application

23546.8k2](/packages/elegantly-laravel-invoices)

PHPackages © 2026

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