Discourse Subscriptions Plugin

Have you got the webhooks configured correctly? I remember these being quite curly to set up, and the instructions of how to do so could be a bit clearer.

Yeah got the webhooks setup nicely thats how the response was flowing back.

I found out the issue. The instructions are missing a point where we have to setup the custom tags with the group name to be promoted to on Stripe price config page.

Its working fine now for me. The plugin is great but documentation is not detailed.

1 Like

Can you explain this just a bit more so we can have someone update the documentation? What custom tag did you add, and where did you add it?

[Guide] How to Set Up Discourse Subscriptions with Stripe Pricing Tables (and Common Pitfalls)

Hello everyone,

After a lengthy troubleshooting process, I wanted to share a definitive guide for setting up the official discourse-subscriptions plugin using the modern Stripe Pricing Table method. This approach is powerful but has a few critical steps that are not immediately obvious and can lead to errors like failing webhooks (404 Not Found) or users not being added to groups after a successful payment.

Here is the step-by-step process that is confirmed to work.


Part 1: Stripe Configuration

This process uses Stripe as the “source of truth” for all products and prices.

1. Create Your Products and Prices

  • In your Stripe Dashboard, make sure you are in Live Mode.
  • Go to Products > Product catalog.
  • Create your main products first (e.g., “Premium Membership”, “VIP Access”).
  • Under each product, create all the associated prices (e.g., XX / month, XXX / year).

2. The CRUCIAL Metadata Step For the plugin to automatically add users to a group, you must add specific metadata to every single Price object you create. The Stripe dashboard UI can make this hard to find.

  • When creating a new price (or if you can find the “Edit price” option), you must add metadata. You may need to click on “Additional options” during price creation to reveal the metadata fields.
  • Click + Add metadata and enter the following:
    • KEY: group_name
    • VALUE: The group’s unique, URL-safe slug/handle from Discourse, not its full name.

Example:

  • If your Discourse group’s full name is “Enclave Plus”, its slug is likely EnclavePlus.
  • You must use EnclavePlus as the value. Using "Enclave Plus" with a space will fail.
  • You must repeat this for every price plan you want to link to a group.

3. Create Your Stripe Pricing Table

  • Go to Products > Pricing tables.
  • Create a new table and add the Prices you just configured.
  • After publishing the table, click the “Copy code” button to get your Pricing table ID (it starts with prctbl_...).

4. Configure the Webhook Endpoint (The 404 Error Fix) This is the most common point of failure.

  • Go to Developers > Webhooks and click + Add endpoint.
  • The Endpoint URL must be in the following format:https://your-discourse-site.com/s/hooksNote: The correct path is /s/hooks, not /s/stripe/webhook.
  • For Events to send, add at a minimum:
    • checkout.session.completed
    • customer.subscription.deleted
  • Create the endpoint and copy the Signing secret (it starts with whsec_...).

Part 2: Discourse Configuration

Now, let’s configure the plugin to use everything you set up in Stripe.

1. Enter API Keys and Pricing Table ID

  • Go to Admin > Settings and search for discourse subscriptions.
  • Fill in your live Stripe keys:
    • discourse subscriptions public key (pk_live_...)
    • discourse subscriptions secret key (sk_live_...)
    • discourse subscriptions webhook secret (whsec_...)
  • Enable the pricing table mode:
    • Check the box for discourse subscriptions pricing table enabled.
    • Paste your prctbl_... ID into the discourse subscriptions pricing table id field.

2. Link Stripe Products to Discourse Groups Even with a pricing table, you need to tell Discourse which group belongs to which product.

  • Go to Admin > Plugins > Subscriptions and click the Products tab.
  • Click Create New Product.
  • Enter a Product Name that exactly matches the Product Name in Stripe (e.g., Enclave Plus).
  • Save the product. On the product’s page, scroll down and click Add New Plan.
  • This plan is just a “bridge”. The only critical field is User Group.
    • Plan Nickname: Enclave Plus Group Link (or anything for your reference).
    • User Group: Select the correct Discourse group from the dropdown.
    • The other fields (Amount, Interval) can be left as default, as they will be ignored.
  • Save the plan. Repeat this for all your different products.

Troubleshooting Summary

  • Problem: Webhooks are failing with a 404 Not Found error.
    • Solution: Your Endpoint URL in Stripe is wrong. It must be https://your-discourse-site.com/s/hooks.
  • Problem: The webhook is successful (200 OK) and the payment appears in the user’s billing profile, but they are not added to the group.
    • Solution: Your metadata is incorrect. Check three things:
      1. The metadata must be on the Stripe Price object, not the Product object.
      2. The metadata KEY must be exactly group_name.
      3. The metadata VALUE must be the group’s unique slug/handle (e.g., EnclavePlus), not its full name with spaces.

I hope this guide saves others the time and frustration of this complex but very powerful setup.

3 Likes

I just tested this out and it was perfect! We will go ahead and update the original documentation to include this!