discourse/plugins/discourse-patreon
Rafael dos Santos Silva bbc2fed22b
FIX: Patreon API pagination bugs causing missing pledges (#39058)
## Summary

- **Nil patron data crash**: Patreon V1 API can return pledge entries
where `relationships.patron.data` is null (deleted/deactivated
accounts). This caused `extract` to raise `NoMethodError`, preventing
`save!` from completing — leaving the pledge store stuck at stale data
(exactly 100 pledges from a previous sync). Fixed with `dig` for safe
nil traversal, skipping entries with missing IDs.
- **Double base URL**: Pagination `next` links from Patreon are absolute
URLs, but `Api.get` was prepending the base URL again
(`https://api.patreon.comhttps://api.patreon.com/...`). Fixed by
detecting absolute URIs and using them directly.
- **Non-incremental saves**: All pages were collected before a single
`save!`. If any page failed, nothing was persisted. Now each page is
saved incrementally — first page clears stale data, subsequent pages
append. Also handles the edge case where the API returns empty data by
explicitly clearing the store so ex-patrons don't keep group access.
2026-04-01 17:18:51 -03:00
..
app DEV: Upgrade Patreon plugin to API v2 with v1 backward compatibility (#38871) 2026-03-30 14:43:34 -03:00
assets DEV: Migrate to @ember/reactive/collections (#38221) 2026-03-23 17:44:41 -03:00
config I18N: Update translations (#39029) 2026-04-01 11:13:02 +02:00
db/migrate
lib FIX: Patreon API pagination bugs causing missing pledges (#39058) 2026-04-01 17:18:51 -03:00
public/images
spec FIX: Patreon API pagination bugs causing missing pledges (#39058) 2026-04-01 17:18:51 -03:00
svg-icons
package.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00
plugin.rb DEV: Upgrade Patreon plugin to API v2 with v1 backward compatibility (#38871) 2026-03-30 14:43:34 -03:00
README.md
tsconfig.json DEV: Add a script for generating external types in discourse-types (#37095) 2026-03-09 20:37:43 +01:00

Discourse Patreon

Enable syncronization between Discourse Groups and Patreon rewards, and enable Patreon Social Login,

Installation

Proceed with a normal installation of a plugin.

After Installation

You need to fill the following fields on Settings -> Plugins:

  • Client ID
  • Client Secret
  • Creator's Access Token
  • Creator's Refesh Token

To get those values you must have a Creator account first.

Then go to Clients & API Keys and fill the necessary info.

The Redirect URIs must be http://<DISCOURSE BASE URL>/auth/patreon/callback, like https://meta.discourse.org/auth/patreon/callback for example.

Then you use the generated tokens to configure the plugin.

Webhooks

You should create Patreon Webhooks so every new pledge get's synced to Discourse ASAP.

To get it working, create a new Webhook for each trigger type and point then to https://<DISCOURSE BASE URL>/patreon/webhook, like https://meta.discourse.org/patreon/webhook for example.

Group Sync

If you want to give your patrons a special treatment on your board, you can create rules between Discourse Groups and Patreon reward tiers.

This can pave the way to grant category access, titles and custom css to please your patrons!

Social Login

This plugin will also enable a Social Login with Patreon, making it easier for your patron to sign up on Discourse.

About

This is a work in progress! Feel free to use and ask questions here, or on Meta.

TODO

  • Button to invite patrons who aren't on Discourse yet.