I tried using the User->sparkPlan() method to get the user's current plan, but in testing I noticed that it doesn't return the Free plan if a user was previously on a paid plan and had canceled the plan. In that case, it continues to return the previous paid plan, not the free plan like I would expect.
Is there a different built in method I should be using to get the user's current plan? Or do I need to build my own version of sparkPlan() to get the true current plan?
When the plan is cancelled, Stripe sends the callback and the subscription in the subscriptions table is updated with a new ends_at date / time. When the current date passes the ends_at date, the User->sparkPlan() still returns the expired plan, but the subscribed middleware returns false. For this reason, I would expect sparkPlan() to return the free plan but it doesn't so I'm not sure if this is a bug or if it's expected that we implement a process to move the user back to the free plan.
The doc block for the sparkPlan() method says:
/**
* Get the Spark plan that corresponds with the given subscription.
*
* If they are not subscribed and a free plan exists, that will be returned.
*
* @param string $subscription
* @return \Laravel\Spark\Plan|null
*/
So based on that description, I'm assuming that it's a bug.