Laravel Spark, only showing the cancel subscription option after adding a subscription plan

1.1k views Asked by At

After connecting the stripe payment system with my Laravel Spark installation I quickly setup some subscription options. Next, I subscribed to one of them using the test credit cards. Everything seems fine at the Stripe dashboard. However, if go the subscriptions page, I only see a big CANCEL SUBSCRIPTION button and not the selected subscription as well as the other subscriptions. I didn't touch the Spark components since I'm afraid to break something... so most of the stuff is pretty vanilla except for the configuration input. I checked with Chrome developer and these are the errors that seems to be linked:

app.js:42231 [Vue warn]: Error in render function: "TypeError: Cannot read 
property 'active' of undefined"

found in

---> <SparkUpdateSubscription>
   <SparkSubscription>
     <SparkSettings>
       <Root>
warn @ app.js:42231
app.js:42318 TypeError: Cannot read property 'active' of undefined
at Proxy.render (eval at createFunction (app.js:51564), <anonymous>:2:24583)
at VueComponent.Vue._render (app.js:45869)
at VueComponent.updateComponent (app.js:44288)
at Watcher.get (app.js:44629)
at new Watcher (app.js:44618)
at mountComponent (app.js:44292)
at VueComponent.Vue$3.$mount (app.js:49600)
at VueComponent.Vue$3.$mount (app.js:51803)
at init (app.js:45245)
at createComponent (app.js:46884)

Anyone had this error or have an idea to fix it?

[edit] When I click the cancel button, I don't see any subscriptions at all and have the following error:

Interestingly, when I click the only button (the cancel subscription button) I don't see any subscriptions anymore and have the following error:

app.js:42231 
[Vue warn]: Error in render function: "TypeError: Cannot read property 'name' of undefined"

found in

---> <SparkResumeSubscription>
   <SparkSubscription>
     <SparkSettings>
       <Root>

Thanks in advance

2

There are 2 answers

2
Tom Barrington On

I just hit this issue too. This was happening because the user you are logged in as has a stripe_plan in the subscriptions table that has been deleted from SparkServiceProvider. As per Laravel Spark docs, do not delete a plan but rather archive it: https://spark.laravel.com/docs/4.0/billing#archiving-plans.

To resolve the issue, add your previous plan back into the booted() method in app/Providers/SparkServiceProvider.php but with the archived() method chained to it:

Spark::plan('Plan', 'my-archived-plan')
    ->archived()
    ->price(100)
    ->features([
        'Feature 1',
        'Feature 2',
        'Feature 3',
    ]);
0
Mike Stratton On

I had the same problem and it was the result of trying to add Laravel/Cashier single payments. I resolved it by removing

use Laravel\Cashier\Billable;

and

use Billable;

from app/User.php