2

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

helloworld
  • 223
  • 1
  • 7
  • 24
  • 2
    Hard to tell but if you get an error like that it means it is trying to find `active` on a property that is not defined, so like this: `subscription.active` in this case `subscription` is never defined. Try to find out why this happens. – Stephan-v Aug 30 '17 at 14:46
  • Interestingly, when I click the only button (the cancel subscription button) I see additional stuff, I've updated the question – helloworld Aug 30 '17 at 17:10

2 Answers2

2

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',
    ]);
  • Thanks, that is a good point. It didn't solve my problem, in my case it was a stupid type. I imported the billable system not only in the top but also in my class. No errors at all, but only this cancel subscription thing... – helloworld Sep 15 '17 at 20:29
  • I am facing same issue. Can you please help me to resolve it? – harry Jun 19 '18 at 18:01
2

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

Mike Stratton
  • 463
  • 1
  • 7
  • 20