$user->subscription($plan) returns null.
Are you sure $request->input('plan') returns the correct value?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I've got a stock install of Laravel 5.6 and the latest Cashier: 7.0
Here's the flow:
$this->json('POST','v1/users', $newUserData)
In my UserController I do the following:
$u->newSubscription($plan, $stripe_plan)
->create($token, ['email' => $u->email]);
I then try to cancel that account in the test by doing:
$this->json('DELETE','/v1/users/'.$content->id, ['plan' => $planName])
The create works fine - after dd'ing alot of things I can see that all the data is going into the database. In fact - I can see the customers created in stripe AND subscribed to the plans in stripe....
BUT when I try to cancel the subscription in my delete method of my UserController:
$user->subscription($request->input('plan'))->cancel();
I get the following error:
Call to a member function cancel() on null
This one has me stumped...anybody got any ideas?
Please or to participate in this conversation.