Im using Laravel 5.2 and Laravel cashier. It seems to be working and able to subscribe users to plans, cancel plans and resume plans. But when I try to do a grace period check I get an error that reads:
Call to a member function onGracePeriod() on null
My code is:
if ($user->subscription('Pro')->onGracePeriod()) {
$userOnGrace = "true";
}
echo $userOnGrace;
I followed the instructions on https://laravel.com/docs/5.2/billing#checking-subscription-status
It means your $user->subscription('Pro')
return null( this user doesn't subscribed to "Pro"). You can check try to like that:
if ($user->subscription('Pro') && $user->subscription('Pro')->onGracePeriod()) {
$userOnGrace = "true";
}