Have updated the first post with the repo.
Setup and Configuration Guide
This guide will walk you through setting up the necessary payment providers and creating your first products and plans.
1. Provider Setup
First, navigate to Admin > Settings > Plugins and select your primary payment provider from the discourse_subscriptions_payment_provider setting. Then, follow the instructions for your chosen provider below.
A) Configuring Stripe
If you chose Stripe as your provider:
- Fill in API Keys: In your Discourse settings, provide your Stripe API keys:
discourse_subscriptions_public_key(Your Stripe Publishable key)discourse_subscriptions_secret_key(Your Stripe Secret key)
- Set up the Webhook: This step is crucial for tracking recurring payments, cancellations, and other subscription events.
- In your Stripe Dashboard, navigate to Developers > Webhooks.
- Click “Add an endpoint”.
- For the Endpoint URL, enter:
https://your-discourse-url.com/s/hooks - Click “Select events” and add the following three events:
checkout.session.completedcustomer.subscription.deletedcustomer.subscription.updated
- Click “Add endpoint”.
- On the next page, find the Signing secret (it starts with
whsec_...). - Copy this secret and paste it into the
discourse_subscriptions_webhook_secretsetting in Discourse.
B) Configuring Razorpay
If you chose Razorpay as your provider:
- Fill in API Keys:
- In your Razorpay Dashboard, go to Settings > API Keys to generate a new key pair.
- Copy your keys and paste them into the corresponding Discourse settings:
discourse_subscriptions_razorpay_key_iddiscourse_subscriptions_razorpay_key_secret
- Set up the Webhook: This step is crucial for confirming that a payment was successfully captured.
- In your Razorpay Dashboard, go to Settings > Webhooks.
- Click “+ Add New Webhook”.
- For the Webhook URL, enter:
https://your-discourse-url.com/s/hooks/razorpay - Create a Secret and keep it safe for the next step.
- Under Active Events, select only
payment.captured. - Click “Create Webhook”.
- Copy the secret you just created and paste it into the
discourse_subscriptions_razorpay_webhook_secretsetting in Discourse.
2. Creating Products and Plans
Navigate to Admin > Plugins > Subscriptions to manage your products and plans.
Create a Product
- Go to the Products tab.
- Click “Create New Product”.
- Fill in the details. The “Description” field supports markdown and will be shown to users on the new pricing page.
Create Plans for the Product
- After creating a product, click the edit icon (✎) next to it.
- In the “Pricing Plans” section, click “Add New Plan”.
- You can create two types of plans:
- To Create a Recurring Plan (e.g., Monthly/Yearly):
- Check the “Recurring Plan?” box.
- Set the Amount and Billing Interval (month, year, etc.).
- Assign it to a User Group.
- To Create a One-Time, Time-Limited Plan (e.g., 30-Day Pass):
- Leave the “Recurring Plan?” box unchecked.
- Set the Amount.
- A new field, “Duration (in days)”, will appear. Enter the number of days the user should have access (e.g.,
30). - Assign it to a User Group.
3. New Administrative Tools
This version includes new tools for manually managing subscriptions.
- Granting a Subscription:
- From the main
Admin > Plugins > Subscriptionspage, click the “Grant Subscription” button. - In the modal that appears, select a username and a plan.
- If the chosen plan is a one-time plan, you can specify a duration in days. If you leave this blank, the user will be granted permanent access to the associated group.
- From the main
- Revoking a Subscription:
- Navigate to the Subscriptions tab in the admin section.
- Any non-recurring subscription (i.e., Manual or Razorpay) will have a “Revoke Access” button.
- Clicking this will immediately remove the user from the associated group, ending their access.