Discourse Subscriptions

I would have if I were sure that I understood. :wink:

OK. Done.

This moves this from a bug/feature problem with the plugin to a user error.

I’m hoping to have a test site using this plugin up in the next week or two. . .


The only way to do this right now is with the rake subscriptions:import task. This was built to handle an edge case after a refactor, though I’m open to additions. #pr-welcome!

Plans should be able to be deactivated in the edit screen.


Yes - it will cancel at the end of the subscription period. This is only valid for recurring items, though. If a one time purchase is refunded, group access will need manual removal.


@ajmuir @pfaffman it’s not 100% ready yet. I have some feedback to implement on the PR and have been focused on other things. Will be merged this week though!

It’s on the list!


Hey Justin. Since you’ve taken this over, I think it’d make sense if the OP changed ownership (you could include a reference to the fact that someone else started the plugin, but it does seem like yours now!). But that’s not why I’m writing.

I’ve said it before, but I’m really close to making semi-public a plugin that I’ve made that uses subscriptions to replace WordPress as the tool that I use for people to get my script to install Discourse for them. When they purchase a “server”, they are added to the group, and my plugin uses a GroupUser callback to create the server in my plugin’s model and then remove them from the group (so they can purchase another server). This all (?) works as expected.

And I’ve now adopted code in the custom header links theme component to add links to their server(s) after they are created. It even does differnt stuff if the server is “new” and if it has not yet been configured/installed.

The remaining problem is that after you make the purchase the purchaser can’t tell that anything has happened. I’d be happy enough if I knew how to do a window.location.reload(true); when a subscription had been purchased so that the link would show up at the top of the page. But it seems that having a field that you could customize some text like "Thanks for your purchase! Now you can see this category and see this link for more information about your subscription`. Or something like that.

Or maybe I should try again to submit a PR with some plugin outlets for me to be able to do stuff like this? (I figured it out once, but wasn’t quite sure just what plugin outlets really made sense, and now my fork is way behind.)


In case anyone is wondering, while Subscriptions don’t cancel in stripe until they were originally scheduled to end:

You can tell Stripe to cancel immediately (as perhaps in the case of a refund):

Stripe will then tell Discourse via the webhooks to remove the user from the Subscription group as you will probably want.

Stripe Customer refunds are a separate, independent step from cancelling Subscriptions.


Is there a way to prevent moderators from accessing the subscription plugin? Right now, moderators can update and delete products created by the admin. Also they are able to create new products and even view and cancel subscriptions. That doesn’t seem right.


Hi folks,

Is there a way to import existing Stripe products and plans into the plugin? I set up membership plans in Stripe last week before I installed the plugin, and I would like to use them directly rather than having to create new ones specifically for Discourse.

Thank you!


There is in fact. See the included rake task.


I’ll have a look at this. You’re right - moderators shouldn’t have access.

Wanted to announce a new feature

Campaigns! You can now show a “Support our site” banner and take donations, tracking one of two different types of goals (subscribers or amount raised). This is perfect if you have a recurring hosting cost you’d like to try to get covered.

Additionally, we’ve made it super easy to start a campaign. Once your Stripe public, secret, and webhook keys are set up, click the Auto-Create Support Campaign button under Admin → Plugins → Subscriptions to generate everything you need with one click.

We’ll be working on updated documentation for all of this soon, too.


Ah yes, it seems from what was written here in this thread that it would only import the subscriptions and not the products. I see after looking at the actual rake task that it imports the other required parts too. Thank you!


Here is a follow-up:

I created a subscription for myself last week using one of the plans that I’m importing into Discourse Subscriptions. Is there a guide for how to map existing subscriptions to Discourse users?

1 Like

If you follow the rake file you can see where it’s pulling Discourse username from in Stripe.


Thank you very much! I was able to import my existing subscription after adding the user_id and username metadata fields to it and running the rake task again.


Absolutely genius, thanks.

The automatically created top/sidebar banner is wonderful. I wonder if it is possible to develop a solution for mobile users (which are nowadays the majority visiting the forum) where it will always appear on top even when we choose sidebar on desktop. Otherwise there’s a chance they will miss it.

I also assume that the auto-inclusion in the supporter group (with supporter flair and so on) terminates after a month on the monthly plans and after a year on the yearly ones, right?


If your webhooks are set up correctly, the plugin will auto-remove group membership (and as a result, flair) when the membership expires.

This would be relatively easy to do. I’ll add it to the backlog!


PR is up for this here.

PR up to fix this here:

EDIT: These PRs are merged.


3 posts were split to a new topic: Validate coupon codes

Does this play nicely with Discourse Connect/SSO?

It hasn’t been tested, but it likely would. We’re not doing anything funky with user accounts; only associating data with users on the site.

Is there any way to cancel purchases that are one time? I have this set up as a way to ticket people for a certain section of my site to view a film my group made, and if someone requests a refund, I can refund them through Stripe fine, but Discourse does not realize they don’t have permissions anymore, I believe because the webhook is only triggered if a subscription is canceled, not if a one time transaction is refunded. Is this something that could be possible?