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

ActiveLibrary[Payment Processing](/categories/payments)

emmanuelsaleem/laravel-stripe-manager
=====================================

Complete Laravel Stripe management package with UI for customers, products, subscriptions and payments

v1.0.4(6mo ago)160[4 issues](https://github.com/es-77/laravel-stripe-managers/issues)MITPHPPHP ^8.1

Since Oct 27Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/es-77/laravel-stripe-managers)[ Packagist](https://packagist.org/packages/emmanuelsaleem/laravel-stripe-manager)[ Docs](https://github.com/es-77/laravel-stripe-managers)[ RSS](/packages/emmanuelsaleem-laravel-stripe-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

Laravel Stripe Manager
======================

[](#laravel-stripe-manager)

A comprehensive Laravel package for managing Stripe customers, products, subscriptions, and payments with a complete web interface.

🚀 Quick Start
-------------

[](#-quick-start)

### Installation

[](#installation)

1. **Install the package via Composer in your Laravel project:**

Navigate to your Laravel application directory:

```
cd /path/to/your/laravel-application
```

Then install the package:

```
composer require emmanuelsaleem/laravel-stripe-manager
```

For a specific version:

```
composer require emmanuelsaleem/laravel-stripe-manager:^1.0.1
```

For the latest development version:

```
composer require emmanuelsaleem/laravel-stripe-manager:dev-master --ignore-platform-reqs
```

> **Important:** The migration will automatically add a `stripe_id` column to your `users` table if it doesn't already exist. No additional User model setup is required!

2. **Install required dependencies:**

```
composer require laravel/cashier stripe/stripe-php
```

3. **Publish and run migrations:**

```
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelStripeManager\StripeManagerServiceProvider" --tag="migrations"
php artisan migrate
```

4. **Publish views (optional):**

```
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelStripeManager\StripeManagerServiceProvider" --tag="views"
```

5. **Publish configuration:**

```
php artisan vendor:publish --provider="EmmanuelSaleem\LaravelStripeManager\StripeManagerServiceProvider" --tag="config"
```

### Configuration

[](#configuration)

1. **Add Stripe credentials to your `.env` file:**

```
STRIPE_KEY=pk_test_your_publishable_key
STRIPE_SECRET=sk_test_your_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
CASHIER_CURRENCY=usd
```

🌐 Web Interface Access
----------------------

[](#-web-interface-access)

Once installed, you can access the complete web interface at:

### Main Dashboard

[](#main-dashboard)

```
http://yourdomain.com/stripe-manager

```

### Available Routes

[](#available-routes)

- **Dashboard**: `/stripe-manager` - Overview with statistics
- **Products**: `/stripe-manager/products` - Manage products and pricing
- **Customers**: `/stripe-manager/customers` - Manage customers and payment methods
- **Subscriptions**: `/stripe-manager/subscriptions` - Manage subscriptions
- **Subscriptions Sync**: `/stripe-manager/subscriptions-sync` - Import existing Stripe subscriptions
- **Stripe Testing**: `/stripe-manager/testing/stripe` - Inspect Stripe customer data
- **Webhooks**: `/stripe-manager/webhooks` - Webhook management and logs

### Authentication Required

[](#authentication-required)

All routes require authentication. Make sure users are logged in before accessing the interface.

📋 Features
----------

[](#-features)

- ✅ **Customer Management**: Create, update, and manage Stripe customers
- ✅ **Card Storage**: Store and manage customer payment methods locally
- ✅ **Product Management**: Create and manage Stripe products with multiple pricing tiers
- ✅ **Pricing Management**: Assign and manage product pricing with recurring/one-time options
- ✅ **Subscription Management**: Create, update, cancel, and resume subscriptions
- ✅ **No Repeat Trial**: Re-subscribing to the same plan skips free trial and charges immediately
- ✅ **Webhook Handler**: Handle Stripe webhooks for payment events
- ✅ **Web Interface**: Complete UI for managing all Stripe resources
- ✅ **Payment Tracking**: Store and track subscription payments locally
- ✅ **Multiple Payment Methods**: Add, list, set default, and delete cards per customer
- ✅ **Product Ordering**: Drag-and-drop product ordering saved via `display_order`
- ✅ **Subscriptions Sync**: One-click sync of existing Stripe subscriptions into local DB, with skip report
- ✅ **Stripe Testing Panel**: Inspect Stripe customer, subs, invoices, PMs, next invoice, and recent charges
- ✅ **Polished UI**: Bootstrap 5 styling with a cohesive dark theme and improved pagination

🔌 API (Optional)
----------------

[](#-api-optional)

The package exposes a minimal REST API for integrating your frontend or other services. The base path and middleware are configurable.

### API Documentation

[](#api-documentation)

Explore and test the REST API using the Postman documentation:

- Postman Docs:

### Configure

[](#configure)

In `config/stripe-manager.php`:

```
'api_routes' => [
    'prefix' => 'api/stripe-manager',
    'middleware' => ['api'], // e.g. ['api','auth:sanctum']
],
```

Base URL: `{APP_URL}/{prefix}` (default: `/api/stripe-manager`)

### Endpoints

[](#endpoints)

1. GET {prefix}/plans

- Returns active products with active pricing from local DB (not Stripe).

Response

```
{
  "data": [
    {
      "id": 1,
      "name": "Pro",
      "description": "...",
      "stripe_product_id": "prod_...",
      "pricing": [
        {
          "id": 10,
          "stripe_price_id": "price_...",
          "nickname": "Monthly",
          "unit_amount": 1999,
          "currency": "usd",
          "type": "recurring",
          "billing_period": "month",
          "billing_period_count": 1,
          "trial_period_days": 14
        }
      ]
    }
  ]
}
```

2. GET {prefix}/users/{userId}/subscription

- Returns latest subscription summary for a user (local DB), including next billing date and amount when available.

Response

```
{
  "data": {
    "subscription_id": 5,
    "stripe_subscription_id": "sub_...",
    "status": "active",
    "product": "Pro",
    "price": {
      "nickname": "Monthly",
      "unit_amount": 1999,
      "currency": "usd",
      "billing_period": "month",
      "billing_period_count": 1
    },
    "current_period_start": "2025-10-01 12:00:00",
    "current_period_end": "2025-11-01 12:00:00",
    "next_billing_at": "2025-11-01 12:00:00",
    "next_billing_amount": 1999
  }
}
```

3. POST {prefix}/select-subscription-plan

- Create subscription for user with optional payment method.

Body

```
{
  "user_id": 123,
  "pricing_id": 10,
  "payment_method": "pm_123" // optional
}
```

Response

```
{ "data": { "id": 5 } }
```

Behavior

- No repeat trial: if the user previously subscribed to the same pricing, the trial is skipped and the user is charged immediately.

4. GET {prefix}/trial-info?user\_id=123

- Returns latest trial info (if any) for the user.

5. DELETE {prefix}/cancel-subscription-plan

- Cancels the current subscription. Optional `immediately=true` charges behavior is respected by service.

Body

```
{ "user_id": 123, "immediately": false }
```

6. GET {prefix}/user-payment-methods?user\_id=123

- Lists card payment methods from Stripe for the user.

7. POST {prefix}/save-stripe-id

- Saves a known Stripe customer id on the user.

Body

```
{ "user_id": 123, "stripe_id": "cus_..." }
```

8. POST {prefix}/set-default-payment-method

- Sets the user’s default payment method on Stripe.

Body

```
{ "user_id": 123, "payment_method_id": "pm_..." }
```

### Notes

[](#notes)

- Secure these endpoints by adding your preferred auth middleware (e.g. Sanctum) in `api_routes.middleware`.
- Amounts are in the smallest currency unit (e.g., cents).
- Trials are enforced locally and verified with Stripe when possible to prevent re-trial abuse.

💻 Programmatic Usage
--------------------

[](#-programmatic-usage)

### Customer Service

[](#customer-service)

```
use EmmanuelSaleem\LaravelStripeManager\Services\CustomerService;

$customerService = app(CustomerService::class);

// Create a customer
$user = User::find(1);
$customer = $customerService->createCustomer($user, [
    'name' => 'John Doe',
    'email' => 'john@example.com'
]);

// Store a payment method
$card = $customerService->storePaymentMethod($user, $paymentMethodId, $setAsDefault = true);

// Create setup intent for card collection
$setupIntent = $customerService->createSetupIntent($user);
```

### Product Service

[](#product-service)

```
use EmmanuelSaleem\LaravelStripeManager\Services\ProductService;

$productService = app(ProductService::class);

// Create a product
$product = $productService->createProduct([
    'name' => 'Premium Subscription',
    'description' => 'Access to premium features',
    'active' => true
]);

// Create pricing for the product
$pricing = $productService->createProductPrice($product, [
    'unit_amount' => 1999, // $19.99 in cents
    'currency' => 'usd',
    'recurring' => [
        'interval' => 'month',
        'interval_count' => 1
    ],
    'nickname' => 'Monthly Premium'
]);
```

### Subscription Service

[](#subscription-service)

```
use EmmanuelSaleem\LaravelStripeManager\Services\SubscriptionService;

$subscriptionService = app(SubscriptionService::class);

// Create a subscription
$subscription = $subscriptionService->createSubscription($user, $pricing, [
    'trial_days' => 14,
    'payment_method' => $paymentMethodId
]);

// Cancel a subscription
$subscriptionService->cancelSubscription($subscription, $immediately = false);

// Resume a subscription
$subscriptionService->resumeSubscription($subscription);
```

🔗 Webhook Setup
---------------

[](#-webhook-setup)

1. **Configure webhook endpoint in Stripe Dashboard:**

    - URL: `https://yourdomain.com/stripe-manager/webhooks/handle`
    - Events to send:
        - `invoice.payment_succeeded`
        - `invoice.payment_failed`
        - `customer.subscription.created`
        - `customer.subscription.updated`
        - `customer.subscription.deleted`
        - `customer.subscription.trial_will_end`
2. **The webhook automatically handles:**

    - Payment success/failure tracking
    - Subscription status updates
    - Local database synchronization

🗄️ Database Schema
------------------

[](#️-database-schema)

The package creates the following tables:

- `em_stripe_products` - Stores Stripe products
- `em_product_pricing` - Stores product pricing information
- `em_stripe_subscriptions` - Stores subscription data
- `em_subscription_payments` - Tracks payment history
- `em_stripe_cards` - Stores customer payment methods

Additional columns:

- `em_stripe_products.display_order` (uint, indexed) - for custom ordering

🧪 Testing
---------

[](#-testing)

```
# Run package tests
vendor/bin/phpunit packages/emmanuelsaleem/laravel-stripe-manager/tests
```

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Here's how you can help:

### Development Setup

[](#development-setup)

1. **Fork the repository**
2. **Clone your fork:**

```
git clone https://github.com/yourusername/laravel-stripe-manager.git
cd laravel-stripe-manager
```

3. **Install dependencies:**

```
composer install
```

4. **Create a feature branch:**

```
git checkout -b feature/your-feature-name
```

5. **Make your changes and add tests**
6. **Run tests:**

```
vendor/bin/phpunit
```

7. **Commit your changes:**

```
git commit -m "Add your feature description"
```

8. **Push to your fork:**

```
git push origin feature/your-feature-name
```

9. **Create a Pull Request**

### Contribution Guidelines

[](#contribution-guidelines)

- Follow PSR-12 coding standards
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass
- Use meaningful commit messages

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

❓ FAQ
-----

[](#-faq)

### Is the HasStripeId Trait Required?

[](#is-the-hasstripeid-trait-required)

**No, the trait is optional.** The package works without it by checking the `stripe_id` property directly. However, adding the trait provides helpful methods:

- **With trait:** The package checks `$user->hasStripeId()`
- **Without trait:** The package checks `empty($user->stripe_id)`

Both approaches work identically. The trait is a convenience helper.

### What if I don't have a stripe\_id column?

[](#what-if-i-dont-have-a-stripe_id-column)

Run the migration provided with the package:

```
php artisan migrate
```

This will add the `stripe_id` column to your users table automatically.

🆘 Support
---------

[](#-support)

For support, please:

- Create an issue on the [GitHub repository](https://github.com/emmanuelsaleem/laravel-stripe-manager/issues)
- Contact
- Connect on [LinkedIn](http://linkedin.com/in/es77)

⚙️ Advanced Configuration
-------------------------

[](#️-advanced-configuration)

Optional limits for Stripe API fetches (used by the testing panel):

```
# Optional overrides (defaults shown)
STRIPE_LIST_LIMIT_SUBSCRIPTIONS=10
STRIPE_LIST_LIMIT_INVOICES=10
STRIPE_LIST_LIMIT_CHARGES=8
```

These map to `config/stripe-manager.php` under `stripe.limits`.

🎛 Usage Tips
------------

[](#-usage-tips)

- Customer create page supports search + pagination for large user sets
- Manage multiple cards on a customer’s detail page (add, default, delete)
- Drag-and-drop products on the products list to reorder
- Run Subscriptions Sync to import historical data; skipped subscriptions (no matching local user) are shown with reasons

📝 Changelog
-----------

[](#-changelog)

### v1.0.0

[](#v100)

- Initial release
- Complete Stripe customer management
- Product and pricing management
- Subscription lifecycle management
- Webhook handling
- Payment tracking
- Web interface

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance48

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~4 days

Total

4

Last Release

187d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc3c362ef1cde6e1a4164b254ddebd9b56f75dd87e95c86d50c67c62e1c3bc24?d=identicon)[Emmanuel saleem](/maintainers/Emmanuel%20saleem)

---

Top Contributors

[![es-77](https://avatars.githubusercontent.com/u/101662490?v=4)](https://github.com/es-77 "es-77 (40 commits)")

---

Tags

laravelstripebillingpayment processingpaymentssubscriptionsinvoicestripe billingcheckoutsaaspayment gatewayrecurring billingstripe apipayment-methodscredit cardscustomer managementsubscription-managementstripe-integrationstripe-managementstripe-customersstripe-productsstripe-subscriptionsstripe-paymentsstripe-webhookspricing-tiers

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[mmanos/laravel-billing

A billing package for Laravel 4.

451.3k](/packages/mmanos-laravel-billing)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)[enupal/stripe

Allows customers sign up for recurring and one-time payments with Stripe, perfect for orders, donations, subscriptions, and events. Create simple payment forms in seconds easily without coding. For Craft CMS 3.x

3416.5k1](/packages/enupal-stripe)

PHPackages © 2026

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