Discourse Premium BT

I’m new to building plugins for Discourse so I’m completely open to any critique or feedback on this.

I really wanted a premium section for a new community I recently launched. I’ve worked with Braintree in the past and figured it would give me the integration since I couldn’t find what I wanted. It ended up being built as a plugin so I figured I would share it here.

The set up steps can be found in the README of the GitHub repo here - Discourse Premium BT.

Ultimately, it syncs up with Braintree to create a paywall for a group. You can use the group to create a paid private category or grant badges for premium subscribers. And I’m sure there are other ways to use this that I can’t think of.

And since Ill be looking for ways to encourage people to share the site, there is an affiliate portion that can grant a discount from Braintree when a new user signs up using the current users custom link. This works by setting a cookie when the link is clicked and grants a free month of premium to the referrer when the new user confirms their email.

Here’s a look at the addition to the user preferences:

It is currently able to accept credit cards and PayPal.

Once the user subscribes it changes from “Subscribe” to “Update Payment” and “Cancel Subscription”. But all of the terminology is handled from a locale so you should be able to edit it in your admin settings.

There is also a banner that is displayed at the top of any topic that will help promote the premium section.

Any time something happens that will affect the payment or access to the group, a private message is sent. Right now, here are the messages that are sent:

  1. Subscription success
  2. Payment updated
  3. Subscription cancelled
  4. Free month expiration warning three days out
  5. Free month expired
  6. Free month granted

A few of these messages are triggered from background jobs. There are three of these:

  1. Free month expiration check every hour
  2. Free month expiration warning check every hour
  3. Subscription validation every six hours to ensure payment method is still valid

I’d be more than open to any feedback, PRs, or donations (see paypal button in repo) for this project.

Thanks and enjoy!


  • [DONE] Clean up error messages passed to the user during subscription, payment updates, and cancellation

Edit: Nevermind, I see that @erlend_sh already moved it out of #marketplace

No worries, @jomaxro. I’m just planning to go the donation route. It’s something I wanted for myself and don’t have the time to support. I’ll likely continue fine-tuning it in the future but have no plans to sell it.

Very cool! I’ve been looking for something like this for a while. I was hoping to use Stripe to handle payments since I then can use Baremetrics.io to track recurring revenue in an elegant way. Do you think it would be difficult to switch to use Stripe instead if I wanted to?

In it’s current state, using Stripe would be fairly difficult. The whole structure is built using the Braintree system as an augmenting database of payment information. I didn’t want to deal with the data storage regulations that come with credit card information. That and since Braintree gives you the first $50,000 with zero fees, I figured it’s a good place to start.

As a side note, I’m looking to launch this on a public site sometime next week.


That’s fine, I think I can make Braintree work :slight_smile: I found this (http://www.btmetrics.com/) which could help with analytics.
My production site with real potential customers could be a beta test for this too, when you feel confident about the code :wink:

That metrics site looks interesting. I’ve never had a need for more analytics from Brain tree but I can see how it might be valuable.

I’ll let you know when I’ve had this live for a week or so. I’ll be a lot more confident in it at that point.

1 Like

I’ve been running this for about a week now and it’s been working really well. I haven’t found any glaring issues with it. If you decide to use it, I would highly recommend having SSL set up since you’ll be collecting credit card information.

I applied for a Braintree account to test it out but because my forum is finance related they denied my application. I’ve gone for a Chargebee + Stripe setup instead and then just plan to manually add users to a VIP group in discourse. I’ll keep an eye on this project, though :slight_smile:

Is it possible to change currency to €? langage to French?

I think something has broken with the plugin.

I just installed this plugin on my sandbox, (v1.8.0.beta5 +117), but after the rebuild the site comes up blank. Safe-mode works with Disable unofficial plugins selected.

/logs shows 3 errors:

Job exception: undefined method `users' for nil:NilClass
/var/www/discourse/plugins/discourse-premium-bt/app/jobs/free_month_expiration.rb:7:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Job exception: undefined method `users' for nil:NilClass
/var/www/discourse/plugins/discourse-premium-bt/app/jobs/expiration_warning.rb:7:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Uncaught TypeError: Ember.Handlebars.registerBoundHelper is not a function
Url: http://ec2-35-166-241-189.us-west-2.compute.amazonaws.com/assets/ember_jquery-60dedd1dca1d8b8ce48b6d0087db3b96f3149b9b5af2d0c7c6357967d29031fb.js

Any idea what I did wrong Joe?

I’ve not updated this plugin in over about a year at this point and don’t plan to update at all. I’ve started building out another plugin that does the same thing but in a much better way. You can find that here:

I’ll change the category on this one to broken. Would someone on the @team please close this topic as it’s no longer under development?