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

jlmmns's avatar
Level 12

Different plans for different account types?

With Spark, is it possible to have different subscription plans for different types of accounts?

Say you have a registration form for your usual users, but also a different registration form for partner signups.
Is it then possible to have "normal" plans for the users, and a different set of plans for the partners?

Edit: I think I posted too quick, without really thinking about it.
I thought Spark did everything automatically according to the plans available.
But I can easily filter the plans for different accounts...

0 likes
10 replies
EventFellows's avatar
Level 16

You can define any

->attributes(key => value)

in the SparkServiceProvider within the plans.

I guess you could setup your own key there and then apply your own logic on who can subscribe/ see which plans.

It is the same attributes array that is usesd for maxTeams() etc.

1 like
jlmmns's avatar
Level 12

On another note... Is it possible to have multiple "free" plans?

I notice they are defined as Spark::freePlan().
Can you add multiple of these, and pass an identifier of some sorts?

I see that Spark automatically passes the 'free' identifier...
Does this mean you can only have one free plan?

/**
 * Create a new free plan instance.
 *
 * @param  string  $name
 * @param  string  $id
 * @return \Laravel\Spark\Plan
 */
public static function freePlan($name = 'Free')
{
    return static::plan($name, 'free');
}

However, I guess one free plan is enough.
I could simply handle all the logic according to the account type.

EventFellows's avatar

I believe you could create as many free plans by using a regular plan and just give it a price of 0.-

Every place i have seen the free plan being filtered / regerenced it was done by checking for "price = 0" and not by any other property.

That's not a guarantee that it can be done this way but so far i have not seen anything that would suggest otherwise.

One good usecase for different free plans would be if you wanted different free for monthly and yearly plan. The freePlan() is applied towards both - monthly AND yearly at the same time.

jlmmns's avatar
Level 12

@EventFellows Thanks for the info!

But I don't really understand what you meant in your last paragraph.
Could you maybe explain it differently?

What if I have the following plans:

  • free

  • basic (monthly)

  • basic (yearly)

  • pro (monthly)

  • pro (yearly)

  • partner basic (monthly)

  • partner pro (monthly)

  • partner ... (monthly)

EventFellows's avatar

Yes, of course:

Your 2 basic plans are technically really 2 different plans (and you can define them independantly from each other with different features or whatever you like)

The freePlan technically is just 1 plan but it DOES show up under the monthly plans AND under the yearly plans. You have to check our view that displays the plans to see it.

So - in a case where if you want - a difference between a monthly free plan and a yearly free plan you could make use of a regular plan with price of 0.

1 like
xspark's avatar

@EventFellows

I am using your method to define plan->attributes in SparkServiceProviders.

How do I access the attributes value it in my controllers?

cxbdia's avatar

How are you able to do this?

But I can easily filter the plans for different accounts...

can you please elaborate?

Please or to participate in this conversation.