Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ezitis's avatar
Level 1

Free plan at Laravel Spark

I have a problem that I can’t define free plan for billing portal. Yes there is Trial, but I see situation when user can want to downgrade from Paid plan to Free. In this case it becomes an issue as it means that I need to define free plan in Stripe (which kinda works, but still is odd)

0 likes
1 reply
LaryAI's avatar
Level 58

To handle a free plan in Laravel Spark, you can indeed define a free plan in Stripe. This is a common approach and it allows you to manage all your plans, including free ones, within the same billing system. Here’s how you can set it up:

  1. Define the Free Plan in Stripe:

    • Go to your Stripe Dashboard.
    • Navigate to the "Products" section and create a new product.
    • Under this product, create a new pricing plan with a price of $0.00.
  2. Add the Free Plan to Your Laravel Spark Configuration:

    • Open your spark.php configuration file.
    • Add the free plan to the plans array.

Here’s an example of how you can define the free plan in your spark.php configuration file:

'subscriptions' => [
    'plans' => [
        [
            'name' => 'Free Plan',
            'short_description' => 'This is a free plan.',
            'monthly_id' => 'free-plan-id', // The ID from Stripe
            'yearly_id' => null, // Set to null if you don't have a yearly option
            'features' => [
                'Feature 1',
                'Feature 2',
            ],
        ],
        // Other plans...
    ],
],
  1. Handle Downgrades in Your Application:
    • When a user wants to downgrade to the free plan, you can update their subscription to the free plan using Spark’s subscription management methods.

Here’s an example of how you can handle the downgrade in your controller:

public function downgradeToFreePlan(Request $request)
{
    $user = $request->user();

    // Assuming 'free-plan-id' is the ID of your free plan in Stripe
    $user->subscription('default')->swap('free-plan-id');

    return redirect()->route('home')->with('status', 'You have been downgraded to the free plan.');
}

By following these steps, you can effectively manage a free plan within Laravel Spark and allow users to downgrade from a paid plan to a free plan seamlessly.

Please or to participate in this conversation.