---For More information---
A similar problem occurs when I try to cancel.
I've been trying to follow each line of code (doing dd() and seeing where the error occurs) and everything works right up until the middle of the code block of the "create" method within StripeGateway.php.
$this->billable->setStripeSubscription(
$customer->updateSubscription($this->buildPayload())->id
);
I believe the updateSubscription method is coming from Customer.php, where it has the following code: public function updateSubscription($params = null) { if (is_null($this->subscription)) { return $this->createSubscription($params); } else { return $this->saveSubscription($params); } }
protected function saveSubscription($params)
{
foreach ($params as $key => $value) {
$this->subscription->{$key} = $value;
}
$this->subscription->save();
return $this->subscription;
}
I think the problem that I have is in the second last line: $this->subscription->save(); If I try to dd($this->subscription) before the second last line, I get the following object: Stripe_Object {#220 ▼ #_apiKey: "sk_test_mbybwIzoLf5Imnt6Kh0jkOT7" #_values: array:19 [▶] #_unsavedValues: Stripe_Util_Set {#221 ▶} #_transientValues: Stripe_Util_Set {#222 ▶} #_retrieveOptions: [] }
So it clearly has access to the Stripe_Object. But when I try to run save() on $this->subscription, I get the error: Call to undefined method Stripe_Object::save()
So I have a few questions. I believe the error is telling me that it's looking for the save() method within Stripe_Object or any other class it extends and cannot find this method, so it cannot run it. Am I correct about this?
If I am correct, then where does the save() method come from? Is this a helper from Eloquent? If so, what would i have to extend or use and in which file?
Lastly, where is this saving happening? To my understanding, the updateSubscription method is attempting to save the new change from monthly to yearly within Stripe, and then the rest of the function originally set out by swap() will also save the changes inside our own database under "stripe_plan" column?
Would really appreciate it if anyone might be able to go through this in detail or study the material together with me.