Discourse Subscriptions

:discourse2: Summary Discourse Subscriptions allows site owners to sell recurring and one-time purchase subscriptions that grant access to a group on a Discourse instance.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-subscriptions
:open_book: Install Guide How to install plugins in Discourse

Features

Discourse Subscriptions supports the following features:

  • Create new products and plans from the admin panel
  • Cancel and refund subscriptions from the admin panel
  • Create one time purchase or recurring subscription plans
  • Add free trials on recurring subscriptions
  • SCA/3D Secure support
  • Add/remove users from plan groups as they subscribe/cancel
  • Cancel subscription from user profile
  • Cancellation of subscription at end of subscription period

Terms

  • Subscription - Subscriptions are a recurring payment plan which allow you to control access to content on your community. When a subscription is created or deleted, a user is added or removed from the user group you associate with your subscription plan. A subscription is made up of a product and plans.
  • Product - A product in Stripe’s terms is what you’re selling. A product can contain one or more plans.
    • To add a description to your product, add a metadata field named “description” and use that one instead. You can use Markdown.
  • Plan - A plan contains a price, recurring cycle, and associates with a group to which your subscribers gain access.

:rotating_light: Be very careful to keep your Stripe private keys safe and secure at all times.

:warning: If you were to shut down your instance of Discourse, uninstall this plugin or your site were to go offline, Stripe will continue to bill your customers for your service until the subscription is cancelled.

Configuration

  1. Install & enable the plugin
  2. Configure Stripe
  3. Configure Webhooks & Events in Stripe
  4. Add your Stripe keys (public, secret, webhook secret) under Admin > Plugin > Settings
  5. Create a group for your subscribers to join via purchase
  6. Create a product and plan under Admin > Plugins > Subscriptions
  7. Profit!

Set up your Payment Gateway.

Firstly, you’ll need an account with the Stripe payment gateway. To get started, you can set up an account in test mode and see how it all works without making any real transactions or having to set up a bank account. There is no test mode toggle in the plugin; instead, be sure to use your developer keys (they begin with pk_test, sk_test)

Set up Webhooks and Events in your Stripe account

:bomb: Webhooks are required to make subscription cancellations work fully. Be sure you have them configured correctly.

Once you have an account on Stripe, you’ll need to tell Stripe your website’s address so it can notify you about certain transactions. You can enter this in your Stripe dashboard under Endpoints > URL.

Webhooks address: [your server address]/s/hooks – where [your server address] is the URL of your Discourse install.

You’ll also need to tell Stripe which events it should notify you about via the webhook URL.

Currently, Discourse Subscriptions responds to the following events:

  • customer.subscription.deleted
  • customer.subscription.updated

Add the Stripe API and Webhook keys to your plugin settings

Stripe needs to be authorized to communicate with your website. To do this, it publishes a pair of private and public API keys and a signing secret for your web hooks.

To authorize webhooks, add the API keys and webhook secret from Stripe to your settings page (under Developers).

:warning: Adding production keys will make live payments. If you plan to test, be sure to switch to View test data mode and get pk_test and sk_test keys under Developers.

In your Stripe account settings, see:

Add these keys under the appropriate settings in Admin > Settings > Plugins.

Set up your User Groups in Discourse

When a user successfully subscribes to your Discourse application, after their credit card transaction has been processed, they are added to a User Group. By assigning users to a User Group, you can manage what your users have access to on your website. User groups are a core functionality of Discourse and this plugin does nothing with them except add and remove users from the group you associated with your Plan.

Create one or more products with plans.

Under Admin > Plugins > Subscriptions, click add a new Product. Once you have a product saved, you can add plans to it. Keep in mind that the pricing and billing intervals of plans cannot be changed once you create them. This is to avoid confusion around subscription management.

If you take a look at your Stripe Dashboard, you’ll see all those products and plans are listed. Discourse Subscriptions does not create them locally. They are created in Stripe.

Testing

Test with these credit card numbers:

  • 4242 4242 4242 4242
  • 4111 1111 1111 1111 (no authentication required)
  • 4000 0027 6000 3184 (authentication required)

For more test card numbers: Testing | Stripe Documentation

Visit /s and enter a few test transactions.

Going Live

Once you’re ready to go live, change your API and webhook secret keys to production keys. You will need to create new products and plans in live mode.

Do be aware that if if you don’t properly configure Stripe webhooks, and recurring payments fail to process for any reason (expired credit card, etc.), users will still have access to the group . To have Stripe automatically cancel subscriptions, be sure to set your Manage failed payments settings similar to the below image and configure webhooks as described above.

CHANGELOG

  • 2021-06-02T05:00:00Z Support campaigns added
  • 2021-01-13T06:00:00Z Coupon code creation in admin panel
  • 2021-01-07T06:00:00Z Coupon code support (client only, creation required in Stripe)
  • 2020-11-02T06:00:00Z Subfolder install support
  • 2020-10-30T05:00:00Z Refund subscriptions from admin panel
  • 2020-10-29T05:00:00Z Improve anonymous user UX

TODO #pr-welcome

  • Extend rake subscriptions:import to migrate from other tools

:exclamation: If you were running this plugin prior to 2020-05-22T05:00:00Z, you may need to import subscriptions created by the plugin using the rake task rake subscriptions:import. This will pull products from Stripe, let you choose which to import, and subsequently import the related subscriptions to your site.

109 Likes
Steady plugin for community funding
Group membership subscriptions with profit split
ProCourse Memberships :money_with_wings:
Email drip campaign
Advertise activity in a private category (discourse-category-lockdown)
Please suggest a good Discourse Plugin for Membership that supports Indian Payment Gateway
Discourse for Membership Association Members?
Allow users to donate to pay hosting fees for a site
How to move Topics in Category into their own Pinned Topic inside new Categories?
Login required after some days of free access
User Card Directory
How to give unpaid users limited access without making Discourse private?
User can't repurchase a subscription product after canceling
Discourse Subscriptions + btcpayserver
Send an invite to a user but complete their profile programmatically
Managing Subscriptions through Wordpress (Ultimate Member + Paid Memberships Pro)
Memberful opinions?
Memberful opinions?
Prefill custom html with user's email address?
Can't make the subscription plugin work
Using a plug-in to monetize my Discourse
How to charge members for my Discourse website?
Pay or Play usage?
2020: The Year in Review
Options to manage payments for paid Discourse communities
Latest topics on homepage with only members to read in detail?
Banner text customization for Subscriptions plugin
Subscriptions: Change User's Plan
Donation Bar for House Ad
Integration with Wix.com membership to only let the paid member can access to Discourse
Switching to Discourse Subscriptions from WordPress Subscriptions
WooCommerce Discourse Website newbie help
Looking for feedback on Discourse Subscriptons
Multiple paywalls with common communication hub
Any way to accept paypal or stripe payment at signup?
Platform integration - videos
Discourse Subscriptions - admin creating subscription for user
Discourse Subscriptions - use API to find out product, plan and renewal date
Making group joins automatic to an external pricing plan
Advertise activity in a private category (discourse-category-lockdown)
Steady plugin for community funding
Discourse Subscriptions - user not removed from group when subscription cancelled
Discourse Subscriptions - user not removed from group when subscription cancelled
Discourse subscriptions - changing price during recurring subscription
ProCourse Memberships :money_with_wings:
API POST for New User
Changing excerpt length
Plugin to use Discourse for classified ads or as a job board?
Integration with WP membership Pro
UX: Add metadata to subscription page to improve SEO and link UI design
Add user to group after purchase
ProCourse Memberships :money_with_wings:
Unlock Discourse plugin: Lock topics behind a "crypto" paywall

A post was split to a new topic: Does Subscriptions support BACS?

Could anybody share a link to a forum with this plugin in operation? Thanks.

Well, it’s a rather bizarre use, but dashboard.literatecomputing.com uses it. See Literate Computing Dashboard

I recommend that you install it and try it out in stripe sandbox mode.

I spent ages on the mobile trying to click “Literate Computing Installation Dashboard” under “Community” because I thought it was a link to the dashboard you mentioned in the second link. Also, the hamburger with dots says: “The requested URL or resource could not be found.”

I’ll have a proper look later today! Thanks.

Oh! That’s a server icon. I should hide it if you’re not logged in. Or just remove it since I’ve made home be the server list. Thanks.

2 Likes

How do you make plugin shown for visitors to donate and afterwards contact site-admin to have a VIP or subscribed membership title??

I mean to make it visible for visitors is one thing or priority and to make it site-admin contactable is another optional thing :bowing_man:

I don’t see it in the OP but Allow users to donate to pay hosting fees for a site - #4 by ondrej

1 Like

Cool. But how do I get this banner available on public for visitors not already signed up members??

This page is not shown to outside of logged-in members! The plugin itself was tested for already members not visitors. I mean even a member says would like to contribute but doesn’t see the above banner when he’s logged-out.

Since the plugin works only for logged in members, I don’t know that it’s possible. Why would someone who doesn’t care enough about your community to log in think that they want to give you money?

If you want money on order to participate, you’ll need to allow anyone to create an account and hide categories that you want people to pay for.

I had a look and it looks good. Thanks. I hadn’t realised the user has to log into the forum to pay. I’d thought the paid subscription would be part of the forum registration process, but the way it is makes sense.

1 Like

Right. It is a little annoying. If you think about it, trying to create a user and validate an email address and attach that user to a group all at once is a bit much.

There could be some way to create the user as a staged user that was then connected to the account but then they might sign in with some other email address and not get connected to their payment.

In my case, I’m connecting the payment to a custom model, which is further complicated. I’m also using it to accept payment for one-time jobs, which is working OK, except I keep getting reports that it’s not returning to discourse after the payment. I’m not clear if that’s the fault of my custom code or not (but it’s a good chance).

First of all, thank you for the useful input,
and, mmmmm, I guess you haven’t heard about something called charity or helping a blind person to cross the street for no reason!!!

Most of my members are anonymous whom they donated anonymously in my other prior to Discourse scripts and I think they’re gonna miss that opportunity now :sob:

I’m veering here and wasting the communities time. I was just wondering, how to make this visible to public ie. play with the code or change it to show for all instead of registered member only :slight_smile:

Thanks for all useful replies,

Oh. That’s easy then. If they don’t want to subscribe or be part of the forum, then you don’t need the subscription plugin (or a forum? :person_shrugging:).

Just link to a form on stripe. They’ve made that easier recently, so you can have your logo and so on, though I haven’t paid careful attention.

3 Likes

That’s the way :saluting_face:

But can you be a gentle and speak in plain English to me :smiley:

I mean, how can I do all the things you said if you could lighten me up whereabouts I should be heading. I know you’re off course to help me but appreciated m8.

Thanks for all the awesomeness this site is all about, and to all the Discoursians here :tada:

Well, I don’t know how to do what I’m suggesting, so I probably can’t explain it. But something like this (below) or something like PayPal.me will let you provide a link where people can give you money. The point is that since you don’t need to connect your payments with discourse then you don’t need to have discourse involved at all.

Could you please share a Stripe website URL for these settings? Thanks.

It is here in the OP.

1 Like

It’s not there for me but thanks for the link. I’m going to assume that it only appears when you switch from test to live.

1 Like

Found it! It’s at https://dashboard.stripe.com/settings/billing/automatic – I’ve updated the original post.

2 Likes