The function swap($plan) in vendor/laravel/cashier/src/Subscription.php does the swap correctly but only updates stripe_plan but not 'name'.
create 2 plans -
starter (plan_code) => Starter (name) pro (plan_code ) => Pro ( name )
Upgrade to starter. All good.
From Starter upgrade to Pro - all good.
But, in database, subscriptions table 'name' is still set as Starter.
It should have been updated to Pro.
This causes issue if you are trying to build a billing page as that code is relying on pulling info based on plan name which is Starter but in actual user moved to Pro plan. So, it returns empty.
Can be fixed easily by updating name as well.
$this->fill([ 'stripe_plan' => $plan, 'ends_at' => null, ])->save();
Can be changed to
$this->fill([ 'name' => $planName ( needs to be passed here ) 'stripe_plan' => $plan, 'ends_at' => null, ])->save();
I am using latest version of laravel ( 5.2 ).