Discourse Ko-fi integration

:information_source: Summary Integrate the donation/tip system of Ko-fi with Discourse. Reward donations with badges or group membership.
:hammer_and_wrench: Repository Link https://github.com/magicball-network/discourse-kofi.git
:open_book: Install Guide How to install plugins in Discourse

Features

This plugin allows you to link your Ko-fi account with your Discourse community. People can donate money via Ko-fi, which in turn can grant people rewards like badges or group membership. It also allows you to couple Ko-fi subscription tiers with group memberships.

This plugin relies on the Ko-fi webhook, which will send a notification to Discourse when a payment was received.

You can configure two kinds of rewards:

  1. One-off rewards like badges and group memberships. These rewards are based on the total amount people have paid.
  2. Monthly group memberships based on subscription tiers. People remain a member of the group as long as they keep paying for that subscription tier. Group membership is re-evaluated after a month.

Besides these rewards you can also show a dashboard based on recently received payments.


The different dashboard sections can be enabled and configured to your liking.

You can import the CSV export of Ko-fi to register payments which were made before you installed this plugin.

When payments are received the plugin will match it with users based on the email address they used with the Ko-fi payment, and their Discourse email address. If these addresses are not the same, a user can claim made payments via the special Ko-fi page in the user preferences. It also allows user to hide their transaction from public display.

Configuration

You need to have a working Ko-fi account. After installing the plugin in the usual way you need to configure the Ko-fi webhook token in the plugin’s settings and configure the webhook URL to your Discourse installation: https://example.org/ko-fi/webhook

If you have done this you can send a test message from Ko-fi and check on the plugin’s status page if everything is ok.

You might want to configure rewards before enabling the webhook or importing a CSV. Otherwise you will need to reprocess the rewards to so that they are applied to the present payments.

Settings

Include a table of settings and setting descriptions

Name Description
kofi_webhook_token The webhook verification token you. You can find this in your Ko-fi account.
kofi_account Your Ko-fi account name. This will be used in the dashboard description and Ko-fi widget. If you enable these.
kofi_dashboard_enabled Enable the donations dashboard in Discourse at https://example.org/ko-fi
kofi_dashboard_in_menu Defines if a “Donations” menu item to the dashboard should be added to the menu. If you want to customize this menu item you should disable this option.
kofi_dashboard_topic_id The topic ID which contains the description on the dashboard. A topic with a default message is created in the “staff” category when the plugin is enabled.
kofi_dashboard_widget_enabled Enable the Ko-fi donation widget on the dashboard. This requires the kofi_account to be configured.
kofi_dashboard_count If larger than 0, should this number of recent payments.
kofi_dashboard_types The Ko-fi payment types to include in the recent payments.
kofi_dashboard_anonymous_view Payment details to show on the dashboard for visitors who are not authenticated.
kofi_dashboard_authenticated_view Details to show when authenticated members go to the dashboard.
kofi_goal_amount If larger than 0, enable the “goal” widget on the dashboard. This can be used to show a progress towards given target amount.
kofi_goal_period Period over which to calculate the goal.
kofi_goal_since If you select the “since” period, this will be the timestamp to calculate the goal progress from.
kofi_goal_show_amount If enabled, also show the target amount on the goal widget. Otherwise you will just have a percentage.
kofi_goal_types Discourse payment types which are counted towards the goal.
kofi_goal_progress_bar_integration This enables integration with the Progress Bar Theme Component. When the goal progress is calculated it will update the current and max value settings of this component.
kofi_leaderboard_count If larger than 0, show a leader board widget on the dashboard.
kofi_leaderboard_days Calculate the leader board based on payments from the past days.
kofi_leaderboard_types Ko-fi payment types which are used for the leader board calculation.

Reward Configuration

Besides these settings there is a Rewards tab in the Ko-fi plugin settings where you configure the one-off and subscription rewards.

For subscription rewards you must enter the tier name which you configured on Ko-fi. If you ever change the tier names on Ko-fi you also need to update them there as Ko-fi will only send the display name, and not some kind of unique ID.

When creating or changing rewards you can request the for payments to be reprocessed so that these rewards are granted to existing payments.

Administration

Besides the settings, status, and rewards tabs there are also the following tabs on the Ko-fi plugin admin page:

  • Payments – list of received Ko-fi payments.
  • Accounts – the link between Ko-fi payments and users.
  • Import – import a CSV export of Ko-fi payments. Use this to import already received payments.
  • Anonymize – allows you to completely anonymize payments made by a given email address.
3 Likes

Note that Ko-fi only supports receiving payments in a single currency. For calculations this plugin only considers the amount in the received payment information, not the currency. Changing the currency in the future will mess up various calculations. There is no currency conversion.

This plugin supports anonymization on its own accord, and also hooks into Discourse’s account anonymization. So when you anonymize a user in Discourse it will also anonymize all Ko-fi data that this plugin keeps track of, in the past and future.

I currently rely on a self-hosted PHP script to handle this on my site.

By using your plugin, I won’t anymore. I hope my question is not unwelcome, but I think it’s fair to ask for unofficial plugins: are you likely to maintain this plugin in the long term? Do you use it yourself?

In theory, would you have something against a PR to integrate a public progress bar (akin my theme component)?

From what I understand, the dashboard can be accessed by registered members, but there’s no widget to add elsewhere?

1 Like

I use this plugin on my own Discourse site (but not all features of it). I am going to support the plugin for both ESR (which I run) and the latest Discourse release. Both those releases are tested against in the project setup. These tests run at least once a week if those versions change.

Currently only the Ruby side of the plugin is automatically tested (almost every little part of it). I still need to work out writing sets for the javascript side, which I plan to do eventually.

image

No issues with that. I’d also welcome any suggestions for adding extension points (e.g. plugin outlets for theme components, or events for plugins)

The dashboard is available to all visitors.

I explicitly did not create something to add the ko-fi widget to arbitrary locations. I think that can be done via a theme components, much like your progress bar component. The kofi_account account setting is available for the client, which should be sufficient for any kind of widget.

1 Like