Stripe Subscription Plans

Laratic is configured to easily sell recurring subscription plans. You can create or update subscription plans in your Stripe dashboard and sync them into the database.

1. Create a Product + Recurring Price in Stripe

  1. Create a Product in Stripe.
    • Enter a product name

      create a plan in stripe
    • Add optional data

      create a plan in stripe
    • Define your pricing, either monthly or yearly.

      create a plan in stripe
  2. Stripe will automatically create a price for that product. If you'd like to add trial periods, you can add it through the trial_period_days in price metadata.

    create a plan in stripe
  3. Sync your Stripe products to your database (next step).

2. Sync Plans into the App

You can sync Stripe products/prices into the database in two ways:

  • Admin UI: Go to /admin/plans-products and click Sync now. This also lets you manage sorting and promoting plans. Admin Plans Products
  • Artisan command:
php artisan stripe:sync-catalog

This will sync all active products/prices into the database.

Manage Sorting & Featured Plans

You can manage the sorting and featured status of your plans in the admin UI.

Admin Plans Products

Managing active subscriptions

Users can manage their subscriptions in the subscription management page.

Subscription Management Page

Restrict Access with Subscription Middleware

Use the subscribed middleware to protect routes that require an active subscription. Users without a subscription will be redirected to the pricing page.

Require Any Subscription

Protect a route so only users with any active subscription can access it:

Route::middleware('subscribed')->group(function () {
    Route::get('/premium-feature', fn () => 'Premium content');
});

Require Specific Plan

Restrict access to users subscribed to a specific Stripe price ID:

Route::middleware('subscribed:price_1234567890')->group(function () {
    Route::get('/pro-feature', fn () => 'Pro feature');
});

Require Multiple Plans (Any Of)

Allow access if the user is subscribed to any of the specified price IDs:

Route::middleware('subscribed:price_1234567890,price_0987654321')->group(function () {
    Route::get('/paid-feature', fn () => 'Paid feature');
});