Discourse Subscriptions Plugin

Heb je de webhooks correct geconfigureerd? Ik herinner me dat deze nogal ingewikkeld waren om in te stellen, en de instructies hiervoor konden wat duidelijker.

Ja, ik heb de webhooks mooi ingesteld, zo stroomde de respons terug.

Ik heb het probleem gevonden. De instructies missen een punt waar we de aangepaste tags moeten instellen met de groepsnaam waarnaar gepromoot moet worden op de Stripe-prijsconfiguratiepagina.

Het werkt nu prima voor mij. De plugin is geweldig, maar de documentatie is niet gedetailleerd.

1 like

[quote=“SubStrider, post:710, topic:140818”]De instructies missen een punt waar we de aangepaste tags moeten instellen met de groepsnaam die op de Stripe-prijsconfiguratiepagina moet worden gepromoot.

[/quote]

Kunt u dit iets duidelijker uitleggen, zodat we iemand de documentatie kunnen laten bijwerken? Welke aangepaste tag heeft u toegevoegd en waar heeft u deze toegevoegd?

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

5 likes

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

4 likes

The key missing part in the documentation is this. Pointing out since you quoted another part.

2 likes

Is er een manier om de ankerdatum hiermee automatisch in te stellen? Als iemand betaalt, moet ik de abonnementsperiode handmatig aanpassen om deze voor elke gebruiker in Stripe op de 1e van de maand te laten ingaan.

De documentatie van Stripe zegt dat dit kan met API bij het afrekenen, maar we hebben momenteel geen manier om dit in de plugin aan te passen.

Moving this to the new thread as it could get long as I post updates.

3 likes

:partying_face: This plugin is now bundled with Discourse core as part of Bundling more popular plugins with Discourse core. If you are self-hosting and use the plugin, you need to remove it from your app.yml before your next upgrade.

2 likes

Hoe verwijder ik het uit de core voordat ik upgrade? Aangezien ik de plugin fork zal gebruiken die ik heb verbeterd.

3 likes

Iets als

rm - rf discourse-subscroptions

Voor de git clone.

3 likes

Sorry, ik heb het niet begrepen. Tijdens de herbouw zal het deze geïntegreerde plugin-code ophalen en bouwen, allemaal in één stap, toch?

I haven’t tested this, but I’m pretty sure this will work:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - rm -rf discourse-subscriptions
          - git clone https://github.com/yourForkUser/discourse-subscriptions

Since this gets run from the plugins directory, it’ll remove the discourse-subscriptions that’s now included in core and replace it with the one that you’ve always used before. So adding just that rm -rf to your app.yml before your git clone (for this or any other plugin you want not included or to replace) should do what you want and replace the core plugin with your fork.

6 likes

Oké, dus als ze zeggen dat X-plugin nu deel uitmaakt van de core, bedoelen ze alleen dat de plugin vooraf is verpakt in de core-repository in de plugin-directory en dat we die code niet optioneel hoeven op te halen. Begrepen. Structureel verandert er niets.

1 like

Als het nu vooraf is verpakt. Verlies ik dan alle gegevens in de pluginversie? Moet ik het allemaal opnieuw instellen of wordt het overgezet?

U verliest geen gegevens. Verwijder gewoon de regel uit app.yml en de plugin blijft werken zoals voorheen.

1 like

Is het verwacht gedrag dat na het invoeren van een couponcode het totale abonnementsbedrag niet onmiddellijk wordt bijgewerkt?

Getest op Discourse 3.5.0.beta8-dev

Ik heb ontdekt dat als een gebruiker zich probeert aan te melden en hun betaling mislukt, de vermelding in de discourse_subscriptions_customer tabel die hen koppelt aan hun Stripe-klant-ID wordt verwijderd. Ik weet niet zeker of dit gedrag opzettelijk is, maar ongeacht, ik denk niet dat het goed gedrag is, omdat het resulteert in weesklanten in Stripe die handmatig moeten worden verwijderd. Dit resulteert ook in dubbele klanten die worden aangemaakt als ze opnieuw proberen, wat onze rapportage kan beĂŻnvloeden.

3 likes

Is er een manier om de campagne opnieuw in te stellen? Ik hoopte op een maandelijks donatiedoel, maar het is het begin van een nieuwe maand en ik zie geen manier om het terug te zetten naar nul voor een nieuw maandelijks doel.

1 like

Ik zou deze plugin graag in actie willen zien op een site. Is er iemand bereid om de link naar hun forum te delen waar de Subscriptions Plugin wordt gebruikt? Bedankt!