# Trouble adding a discourse-subscriptions plan

**URL:** https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696
**Category:** Support
**Tags:** subscriptions
**Created:** [May 26, 2021, 2:10pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696 "2021-05-26T14:10:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 26, 2021, 2:10pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/1 "2021-05-26T14:10:14Z")

</div>

I"m trying to create a new plan on my development environment. Clicking “add new plan” does this:

```plaintext
TypeError: Cannot read property 'discourse_subscriptions_currency' of undefined
    at Class.model (javascripts/discourse/routes/admin-plugins-discourse-subscriptions-products-show-plans-show:22)
    at Class.deserialize (route.js:1040)
    at UnresolvedRouteInfoByParam.getModel (router_js.js:895)
    at router_js.js:691
    at invokeCallback (rsvp.js:493)
    at publish (rsvp.js:476)
    at rsvp.js:19
    at invoke (backburner.js:338)
    at Queue.flush (backburner.js:229)
    at DeferredActionQueues.flush (backburner.js:426)

```

and also

```plaintext
Error while processing route: adminPlugins.discourse-subscriptions.products.show.plans.show Cannot read property 'discourse_subscriptions_currency' of undefined TypeError: Cannot read property 'discourse_subscriptions_currency' of undefined
    at Class.model (javascripts/discourse/routes/admin-plugins-discourse-subscriptions-products-show-plans-show:22:44)

```

I can’t tell if this is some issue with my setup or . . . something else. This works in the console started with the same ENV settings (of stripe keys and such):

```plaintext
> SiteSetting.discourse_subscriptions_currency
=> "USD"

```

I"m able to create and update products, but I’m not able to create a plan.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 26, 2021, 6:12pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/2 "2021-05-26T18:12:57Z")

</div>

I think this is why:

[https://github.com/discourse/discourse-subscriptions/pull/66](https://github.com/discourse/discourse-subscriptions/pull/66)

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [May 26, 2021, 7:24pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/3 "2021-05-26T19:24:56Z")

</div>

Ah yes! This is due to the switch to Ember CLI on developer instances – shouldn’t affect production sites for now.

I have a PR that should drop in the next couple of days that refactors this and adds a new feature, too.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 26, 2021, 7:33pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/4 "2021-05-26T19:33:38Z")

</div>

Might this also make it impossible to see new plans? I’ve added plans but they aren’t showing up.

(I’m trying to add a hook to GroupUser that watches the group and then pulls the most-recent subscription ID and adds it to my plugin’s model…)

EDIT: Meanwhile, my PR just got accepted. . .

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [May 26, 2021, 7:35pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/5 "2021-05-26T19:35:42Z")

</div>

> [@pfaffman](#):
>
> EDIT: Meanwhile, my PR just got accepted. . .

I blame @cvx😉 I’ll make sure in my work that I sweep the codebase for more instances of the `Discourse` constant so we’re ready for _the future_.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 26, 2021, 9:20pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/6 "2021-05-26T21:20:30Z")

</div>

Aha. Found the other place and that was what was making it not present plans for sale; I thought I was going crazy. There’s another instance in `s-show.js.es6`, but you’ll find it the same way I did.

Oh, and also a ` Discourse.User.current().username.toLowerCase()`, which I guess should be ` this.current_user.username.toLowerCase()`?

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [June 2, 2021, 6:28pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/7 "2021-06-02T18:28:44Z")

</div>

This should now be fixed with the merging of this:

[https://meta.discourse.org/t/discourse-subscriptions/140818/355?u=justin](https://meta.discourse.org/t/discourse-subscriptions/140818/355)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [July 2, 2021, 6:29pm UTC](https://meta.discourse.org/t/trouble-adding-a-discourse-subscriptions-plan/191696/8 "2021-07-02T18:29:39Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
