Solved
brianh

Oct 6th, 2023 12:36 AM

Hello again,

Final push for my app. Billing is now the topic of the day.

I have three different options I want to present to my clients:

  • Basic
  • Standard
  • Enterprise

Each package needs the option to specify the amount of servers and devices that they can use with the software.

How can I achieve this?

I can provide more information if required.

bobbyiliev

Oct 6th, 2023 08:12 AM

Hey Brian 👋,

Sounds great! Excited to test out your project once it's released.

I think that this could work similar to how you've implemented the max_alerts here.

This time, you could add the column to your Plans table, it could be called something like allowed_servers for example.

Then you could have a method that returns this, eg:

public function allowedServers(User $user)
{
    // Get the maximum allowed servers for the user's plan
    $allowedServers = $user->plan->allowed_servers;

    // Count the number of servers the user has already created
    $currentServersCount = $user->servers()->count();

    return $currentServersCount < $allowedServers;
}

And then you could use that logic to check if the user is allowed to add more servers.

The method could either be included in the plan or in the role. That way you can do the validation based on the plan that the user uses.

Let me know if this would work!

brianh

Oct 6th, 2023 08:44 AM

Hi Bobby,

Excellent. How would I link this to the checkout screen with paddle?

FYI, I do think there is an issue with the Paddle integration at the moment. The reason I suspect this is if we use the plan ID from paddle and input into Wave, we get an error.

brianh

Oct 6th, 2023 09:24 AM

Update:

I figured out the paddle issue.

They only problem I have left is that users need to be able to specify how many servers and devices on checkout. So when they click a subscription plan, they need to have an option to specify the amount of servers and amount of devices. This then will change the total and continue from there.

bobbyiliev

Oct 6th, 2023 10:37 AM

Ah I see! Thanks for that clarification Brian! Would this be a one time charge or will this be the recurring subscription price?

What you could do is actually enable quantities:

That way 1 package can be purchased multiple times. I will have to think how to implement this logic on the backend though :/

brianh

Oct 6th, 2023 10:53 AM

Hi Bobby,

It would be a recurring subscription.

Will tinker around a bit with this.

brianh

Oct 22nd, 2023 01:25 PM

Best Answer

Hey Bobby,

Figured out this one as well.

It's very rough, but it's functional.

Let me know if you want me to give you a rundown on it.