Getting started - best practice

I’d like to be able to offer Patreons access to extra features in our web site.

To do this I need to be able to identify which of our users have made a pledge. However, the Java API documentation for retrieving a list of pledges is incomplete (see the TODO comments here):

https://docs.patreon.com/?java#paging-through-a-list-of-pledges

It also specifies the following URL which looks simple enough to use:

GET https://www.patreon.com/api/oauth2/api/campaigns/<campaign_id>/pledges?include=patron.null

can someone please explain:

  1. Where I find the campaign_id for my Patreon page (I can’t find anything with that name)?
  2. What the include HTTP parameter should be set to? (i.e. what is patron.null)
  3. How to authenticate a GET call using my Client & API Keys?

Apologies if I’ve missed the above in the docs - but I can’t seem to find anything.

Finally - once I have the data shown in the JSON response, how can I link this to the users that have registered on my web site. Do I need to use OAuth to link the accounts or is there a simpler approach?

Thanks.

I realise it’s only been a week since I posted this question, but I wanted to check whether anyone at Patreon is reading this forum and can offer advice?

I’m doing pretty much what you are, but I haven’t been able to get everything I need out of the Java client.

Update: Got it working

On the front end, I’ve got a button to link my creator account, and an alternative version of the same button to link accounts for my patrons:

const basePatLink = "https://www.patreon.com/oauth2/authorize" +
"?response_type=code" +
"&client_id={your client id}" +
"&redirect_url=https://decksofkeyforge.com/my-profile"

const userLink = basePatLink +  "&scope=identity"

const creatorLink = basePatLink + "&scope=campaigns.members"

campaigns.members works for v2 to get campaign info.

On the server I can get the patreon account info (accountToken, refresh token, etc.) with the Java client:

patreonClient.getTokens(code)

Then for my creator account I use the access token to make a rest call and get member info for my campaign (adding in the access token as a Bearer auth header). You can get your campaign id from this same call minus the campaign id + members.

https://www.patreon.com/api/oauth2/v2/campaigns/2412294/members?include=currently_entitled_tiers,user

This includes the tier ids and user ids.

And for individual users I use a rest request to get their user id:

https://www.patreon.com/api/oauth2/v2/identity

You’ll also need to request the tiers for your campaign so you can use the tier ids.

Thanks Coray - I’ll let you know how I get on. I wanted to avoid matching email addresses for our users to their Patreon accounts as many people have more than one address and it’ll mean trouble if we can’t find a match. If I find an alternative approach I’ll let you know.

OK - I’ve got this working. What’s not clear from the documentation is that:

  1. Use OAuth to establish an account link for the user and get their campaign details
  2. Use webhooks to get real time updates for the account
  3. The user ID must be stored somewhere on our server to associate the OAuth and webhook calls with the same user account

The documentation for their services is sadly the worst I’ve come across in many years, it’s full of errors and omissions of important information - I hope this helps.

I agree with you about Patreon’s documentation. It’s completely useless.