# Discourse Subscriptions Plugin

**URL:** https://meta.discourse.org/t/discourse-subscriptions-plugin/140818
**Category:** Plugin
**Tags:** official, subscriptions, payments, included-in-core
**Created:** [February 6, 2020, 4:15am UTC](https://meta.discourse.org/t/discourse-subscriptions-plugin/140818 "2020-02-06T04:15:07Z")
**Posts on this page:** 1
**Showing post:** 712

<div class="post-metadata">

### Author: ![SubStrider](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/substrider/32/512604_2.png) [@SubStrider](https://meta.discourse.org/u/SubStrider)
#### Post date: [July 1, 2025, 6:29pm UTC](https://meta.discourse.org/t/discourse-subscriptions-plugin/140818/712 "2025-07-01T18:29:25Z")

</div>

### **[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.

 ![Screenshot 2025-07-01 at 11.58.13 PM](https://global.discourse-cdn.com/meta/original/4X/2/f/e/2fe0f876448bc6ad1c6076f6d6541a95b7154348.jpeg)

**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/hooks`_Note: 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.

---

_[View the full topic](https://meta.discourse.org/t/discourse-subscriptions-plugin/140818)._
