lucasdotvin/laravel-soulbscription

A plan without periodicity, the Free plan

dev-dev-15 opened this issue ยท 5 comments

The Free plan should be unlimited, so is it possible to just create a plan without providing periodicity_type and periodicity ? everything will keeps working ?

I think the maintainer of this package does not want to engage in billing functionalities which is pretty understandable considering the unlimited scope. but you can achieve this functionality through manually overriding the expiration date and setting it to a pretty far date in the future. or I think it's nullable so you can try setting it to null and the subscription will never expire. although the way I handled free plans on my app is different. I have a command that automatically resumes subscriptions. and what I do regarding the free plan is to automatically resume it when it expires without asking for an invoice payment. and the way to check if it's a free plan depending on your implementation. either it's an extra column such as "is_free "or "price". in your plans table

So you have many ways to deal with the Free plan but it's outside of this package scope. Good Luck

Hey! I've wondered how to address this issue and decided to make the periodicity-related columns nullable, so it will be possible to create plans with no expiration set. I'm working on this right now.
Besides that, @omaressaouaf is right about billing: we are going to keep it out of the scope of this package. ๐Ÿ˜…

Hi! Version 4.1 introduces the ability to create plans without periodicity (which can be used to create "free plans"). Sorry for taking so long to release it! ๐Ÿ˜…

This is what we get when trying to consume a free plan
"LucasDotVin\\Soulbscription\\Enums\\PeriodicityType::getDateDifference(): Argument #3 ($unit) must be of type string, null given, called in /var/www/html/vendor/lucasdotvin/laravel-soulbscription/src/Models/Concerns/HandlesRecurrence.php on line 20"

to

is there any fix for this? thank you

This happened to me for this 2 plan

   $basic = Plan::create([
              "name"             => "basic",
              'periodicity_type' => null,
              'periodicity'      => null,
          ]);

    $monthly = Plan::create([
        'name'             => 'monthly',
        'periodicity_type' => PeriodicityType::Month,
        'periodicity'      => 1,
    ]);