gerardojbaez / laraplans

SaaS style recurring plans for Laravel.
http://laraplans.readthedocs.io
MIT License
180 stars 81 forks source link

Trial is not working #46

Closed ArielMorningstar closed 4 years ago

ArielMorningstar commented 5 years ago

Hi! I'm having an issue with this package. I have succesfully registered 3 plans, each one with a 15 days trial period, but when I register a user with a plan, it doesn't take in count the trial days. For example, I have a user who have a plan that starts at 2019-03-06, the trial ends at 2019-03-21, but it ends at 2019-04-06.

The method I use for register a new subscription is $user->newSubscription($request->plan_name, $plan)->create();

How can I set the trial period succesfully? Thank you for your help!

gerardojbaez commented 4 years ago

You most likely managed to solve the issue by now, but for those having a similar issue, make sure to use $subscription->isActive() to determine if a subscription is within a valid period (ends_at is in the future) or subscription is within a trial period. Using $subscription->isEnded() alone is not enough to determine whether a user can use their subscription as this method only takes into consideration the ends_at attribute.

Feel free to open a new issue if you are using the isActive() method and still experiencing this behavior.