Discourse 订阅插件

:discourse: 摘要 Discourse 订阅插件允许站点管理员销售周期性或一次性购买的订阅,从而授予用户访问 Discourse 实例上特定分组的权限。
:open_book: 安装指南 此插件已捆绑在 Discourse 核心代码中。无需单独安装该插件。

Discourse 订阅插件允许您创建一次性或周期性订阅,用户付费后即可访问受限制的内容。这是为您的社区筹集托管费用的一种绝佳方式。

功能

Discourse 订阅插件支持以下功能:

位于顶部导航栏的“订阅”按钮会将您带至订阅页面 /s,其中列出了您为站点配置的订阅:

一旦用户点击特定计划的“订阅”按钮,它将打开该计划的支付页面:

用户填写支付详情和地址并点击“订阅”后,他们将看到“谢谢!”消息,并被引导至其账单页面:

用户还会被自动添加到您选择的分组中,以便您轻松查看哪些用户已订阅,并在仅限该分组可见的分类中提供受限制的内容。

术语

  • 订阅 - 订阅是一种周期性付款计划,允许您控制社区内容的访问权限。当创建或删除订阅时,用户会被添加或移除到您与订阅计划关联的用户分组中。订阅由产品和计划组成。
  • 产品 - 在 Stripe 的术语中,产品是您销售的东西。一个产品可以包含一个或多个计划。
    • 要为产品添加描述,请添加一个名为“description”的元数据字段,并使用该字段代替。您可以使用 Markdown。
  • 计划 - 计划包含价格、周期性周期,并与一个分组关联,订阅者通过该分组获得访问权限。

:police_car_light: 请始终小心妥善保管您的 Stripe 私钥。

:warning: 如果您关闭 Discourse 实例、卸载此插件或站点离线,Stripe 将继续为您的服务向客户收费,直到订阅被取消。

配置

  1. 安装并启用插件
  2. 配置支付网关(Stripe)
  3. 在 Stripe 中配置 Webhooks 和事件
  4. Admin > Plugins > Installed > Subscriptions > Settings /admin/site_settings/category/discourse_subscriptions?filter=plugin%3Adiscourse-subscriptions. 下添加您的 Stripe 密钥(public, secret, webhook secret)
  5. 创建一个供订阅者通过购买加入的分组
  6. Admin > Plugins > Subscriptions 下创建产品和计划
  7. 获利!

设置您的支付网关。

首先,您需要一个 Stripe 支付网关账户。要开始使用,您可以设置测试模式账户,在不进行真实交易或无需设置银行账户的情况下查看其工作原理。插件中没有测试模式切换开关;相反,请务必使用您的开发者密钥(以 pk_testsk_test 开头)。

在您的 Stripe 账户中设置 Webhooks 和事件

:bomb: Webhooks 对于使订阅取消功能完全正常工作是必需的。 请确保您已正确配置它们。

一旦您在 Stripe 上拥有账户,您需要 告知 Stripe 您网站的地址,以便它通知您某些交易。您可以在 Stripe 仪表板的 Endpoints > URL 中输入此信息。

Webhooks 地址[your server address]/s/hooks – 其中 [your server address] 是您的 Discourse 安装的 URL。

您还需要告知 Stripe 它应通过 webhook URL 通知您的事件。

目前,Discourse 订阅响应以下事件:

  • customer.subscription.deleted
  • customer.subscription.updated
  • checkout.session.completed

将 Stripe API 和 Webhook 密钥添加到您的插件设置中

Stripe 需要被授权与您的网站进行通信。为此,它会发布一对私有和公共 API 密钥 以及用于 webhook 的 签名密钥

要授权 webhooks,请将来自 Stripe 的 API 密钥和 webhook 密钥(在 Developers 下)添加到您的设置页面。

:warning: 添加生产密钥将导致真实支付。如果您计划测试,请务必切换到 View test data 模式,并从 Developers 下获取 pk_testsk_test 密钥。

在您的 Stripe 账户设置中,请参阅:

Admin > Plugins > Installed > Subscriptions > Settings /admin/site_settings/category/discourse_subscriptions?filter=plugin%3Adiscourse-subscriptions. 下的相应设置中添加这些密钥。

在 Discourse 中设置您的用户分组

当用户成功订阅您的 Discourse 应用,且其信用卡交易处理后,他们将被添加到一个用户分组中。通过将用户分配到用户分组,您可以管理用户在您网站上的访问权限。用户分组是 Discourse 的核心功能,此插件除了将用户添加或移除到您与计划关联的分组中外,不对它们进行其他操作。

创建一个或多个带有计划的产品。

在 Admin > Plugins > Subscriptions 下,点击添加新产品。保存产品后,您可以向其添加计划。请注意,一旦创建计划,其定价和计费间隔无法更改。这是为了避免订阅管理方面的混淆。

如果您查看 Stripe Dashboard,您将看到所有产品和计划都已列出。Discourse 订阅不会在本地创建它们。它们是在 Stripe 中创建的。

测试

使用以下信用卡号码进行测试:

  • 4242 4242 4242 4242
  • 4111 1111 1111 1111(无需身份验证)
  • 4000 0027 6000 3184(需要身份验证)

更多测试卡号:Test card numbers | Stripe Documentation

访问 /s 并输入几笔测试交易。

正式上线

一旦您准备正式上线,请将您的 API 和 webhook 密钥更改为生产密钥。您将需要在 live 模式下创建新的产品和计划。

请注意,如果您没有正确配置 Stripe webhooks,并且由于任何原因(如信用卡过期等)周期性付款未能处理,用户仍将拥有该分组的访问权限。要让 Stripe 自动取消订阅,请确保将您的 Manage failed payments 设置配置为类似于下图,并按上述说明配置 webhooks。

更新支付信息

用户可以通过访问账单页面并点击订阅旁边的编辑按钮来更新用于单个订阅的卡片,这将打开此屏幕:

使用 Stripe 定价表的 Stripe Checkout

您还可以选择替换订阅插件的产品和结账页面,转而使用 Stripe CheckoutStripe Pricing Tables

在您的 Stripe Dashboard 中:

  1. 在 Discourse 上创建产品后,转到 Products > Product catalog
  2. 点击您希望包含在定价表中的产品
  3. 点击 Edit product
  4. More Options 并在 Metadata 下输入以下内容:
    • Key: group_name
    • Value: Discourse 上的分组名称(例如 trust_level_0
  5. 点击 Update product 保存

:red_exclamation_mark: 确保分组名称与 Discourse 上 User_Groups 下选择的分组名称匹配

创建您的 Stripe 定价表

  1. 转到 Products > Pricing tables
  2. 创建新表并添加您刚刚创建的产品
  3. 发布表后,复制嵌入代码中的定价表 ID(以 prctbl_... 开头)
  4. 将定价表 ID 粘贴到您的 discourse_subscriptions_pricing_table_id 中,并启用订阅定价表设置。
  5. 点击绿色复选标记以保存两项设置。

推荐步骤:

在 Stripe 内设置定价表时,建议在结账完成后将用户链接到您的站点,否则他们将停留在 Stripe 确认页面上,没有返回您站点的链接。

重定向到 https://<your-site>/my/billing/subscriptions 是订阅的良好选择。对于一次性付款,您可以直接链接到 https://<your-site>/my/billing/payments

自动收取税费

要启用自动收取税费,请勾选 Site Setting 中的 discourse_subscriptions_enable_automatic_tax 框。

如果您启用了它,但未正确配置您的 Stripe 实例以收取税费,用户在完成结账过程后可能会看到此弹出窗口:

这里有 此指南 提供更多信息,但由于插件现在传递了适当的 automatic_tax[enabled]=true 参数,因此应该不需要做太多工作(第 5 步)。

请确保也配置您的注册(第 4 步):

以下是 Stripe 中 Discourse 订阅插件交易示例,显示已自动收取税费:

设置

名称 描述
discourse subscriptions enabled 启用 Discourse 订阅插件。
discourse subscriptions extra nav subscribe 在主导航中显示订阅按钮
discourse subscriptions public key Stripe 可发布密钥
discourse subscriptions secret key Stripe 密钥
discourse subscriptions webhook secret Stripe Webhook 密钥
discourse subscriptions currency 默认货币代码。创建订阅计划时可以覆盖此设置。
discourse subscriptions campaign enabled 启用活动横幅以促进对本社区的经济支持。
discourse subscriptions campaign goal 支持活动的数值目标(订阅者或筹集金额)。
discourse subscriptions campaign type 选择要运行的活动类型(订阅者或每月筹集金额)。
discourse subscriptions campaign banner location 选择活动横幅的位置(顶部或侧边栏)。
discourse subscriptions campaign banner bg image 上传自定义图像用作活动横幅的背景。
discourse subscriptions campaign banner shadow color 选择活动横幅投影的颜色。
discourse subscriptions campaign show contributors 显示最近购买订阅产品的用户的头像。
discourse subscriptions campaign product 当支持者点击活动上的按钮时,发送支持的 Stripe 产品 ID。如果此设置留空,支持者将被引导至主要产品页面。
discourse subscriptions campaign grant 授予用户一个月的免费订阅
discourse subscriptions pricing table id 嵌入代码中的 Stripe 定价表 ID
discourse subscriptions pricing table enabled 启用使用 Stripe 定价表并替换现有的订阅页面
discourse_subscriptions_enable_automatic_tax 切换是否将收取销售税。需要在 Stripe 中进行一些设置。
discourse_subscriptions_enable_verbose_logging 启用更详细的日志记录以辅助调试。请勿在生产环境中永久启用。

:discourse2: 由我们托管? 此插件在我们的 Pro、Business 和 Enterprise 托管计划中可用 Subscriptions | Discourse - Civilized Discussion

139 个赞
Steady plugin for community funding
ProCourse Memberships :money_with_wings:
Group membership subscriptions with profit split
Email drip campaign
How to give unpaid users limited access without making Discourse private?
Super simple Discourse-Wordpress-membership integration
Discourse for Membership Association Members?
Please suggest a good Discourse Plugin for Membership that supports Indian Payment Gateway
Allow users to donate to pay hosting fees for a site
Login required after some days of free access
User can't repurchase a subscription product after canceling
User Card Directory
Subscription Access To Discourse
Multiple paywalls with common communication hub
Discourse Subscriptions + btcpayserver
Do I need Wordpress? Or Discourse can be my solution to ALL?
Send an invite to a user but complete their profile programmatically
Discourse subscriptions - changing price during recurring subscription
Any good Memberpress alternatives for wordpress?
Add user to group after purchase
How to move Topics in Category into their own Pinned Topic inside new Categories?
Discourse vs Skool
Subscription Access To Discourse
Tax implication of funding a forum
Discourse Unlock
Tick badge for username?
Subscription update problem
Setting up a subscription group
How would I install a cryptocurrency paywall?
Charging a membership fee
Discourse Subscriptions with Thrive Cart
Admin creating subscription for user
Plugin for charity donations?
Allow subscription of predetermined length
Link Sign Up to Subscriptions Plugin
User monetization with group access?
Discourse Category Lockdown
Allow option to open Stripe payment website
Is it possible to use the subscription plugin to limit creating topics in a category to subscribers?
Best approach to a landing page/payment front end
Managing consumable AI costs
Allow multiple ‘new topic’ drafts
Stripe iframe causes a blank page on my print layout
No 'deleted' event in Stripe?
Tell us how you manage subscriptions on Discourse
Addding a paid group who can reply to topics but not create them
Integration with WP membership Pro
Alternative sign up pathways
Control Category Visibility and Access by User Levels
Tighter integration of account-creation and subscriptions?
Does the Subscriptions plugin work with "one-off" payment pricing tables?
Subscriber group automation (Remove and Add users to specific group with subscription)
"Support Us" Banner Not Updating
Tip or Pay Button - for user post/content, does it exist already?
May I or can I monetize my forum?
May I or can I monetize my forum?
Bundling more popular plugins with Discourse core
Guest Gate Theme Component
Error loading route Caused by plugin 'discourse-subscriptions'
Embed a list of Discourse topics onto an external site
Blank page when resuming discourse app
Why doesn't Discourse hosting include the Subscriptions plugin on the Starter plan?
Hosting questions
Discourse Category Lockdown
Rebuild fails when these plugins are present
Changing excerpt length
Installing discourse for free?
Options to manage payments for paid Discourse communities
Using a plug-in to monetize my Discourse
ProCourse Memberships :money_with_wings:
UX: Add metadata to subscription page to improve SEO and link UI design
A feature request related to this plugin. Pointed questions or rewarded questions
Plugin to use Discourse for classified ads or as a job board?
Subscription Plugin not working (Error)
How to set message limits for user groups?
API POST for New User
ProCourse Memberships :money_with_wings:
Steady plugin for community funding
New customer setup
Making group joins automatic to an external pricing plan
Platform integration - videos
Any way to accept paypal or stripe payment at signup?
Looking for feedback on Discourse Subscriptons
WooCommerce Discourse Website newbie help
Switching to Discourse Subscriptions from WordPress Subscriptions
Integration with Wix.com membership to only let the paid member can access to Discourse
2020: The Year in Review
Managing Subscriptions through Wordpress (Ultimate Member + Paid Memberships Pro)
How does uninstalling the Subscriptions plugin affect Stripe billing?
Memberful opinions?
Is there an E-commerce plugin for Discourse?
Memberful opinions?
Prefill custom html with user's email address?
Can't make the subscription plugin work
How to charge members for my Discourse website?
Pay or Play usage?
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
Can I use the Subscriptions plugin on my own server?
Limiting Subscription Length
Discourse Subscriptions - use API to find out product, plan and renewal date
Discourse Subscriptions - user not removed from group when subscription cancelled
Discourse Subscriptions - user not removed from group when subscription cancelled