When a user links their Patreon and I get an OAuth token for them, I can use the /api/oauth2/v2/identity endpoint to access limited information about their pledge to my campaign, such as “currently_entitled_amount_cents”. However, in order to get “currently_entitled_tiers”, which is available via /api/oauth2/v2/members, I have to use my own personal OAuth token.
I would like there to be a way to get “currently_entitled_tiers” by either including it in the /api/oauth2/v2/identity endpoint, or by allowing the identity scope to allow access to /api/oauth2/v2/members but only for the current campaign.
I will admit that I might not be the best at English reading comprehension, but one of the main thing I imagine someone wants to do with the API is: know what’s the subscriber’s tier a user is entitled to.
And that took me way longer to figure out than I would have expected.
(I can understand why a lot of app creators chose to publish a monthly post with a code instead of implementing the API. It’s really not as intuitive as it could be to understand. And examples are limited to some -in my opinion- odd scenarios)
Even the solution I came up with does not fill me with confidence if I have to be honnest. The info is deeply nested, and, side tracking a bit, it seems the delete webhook instantly notify of a member unsubscribing even if they are still entitled to their benefits until the end of the month.
Not sure what’s the best implementation aproach to handle that. I read the doc multiple times but nothing obvious jumped to me.
Are there good examples or up to date tutorials documenting how to check a member’s entitled tier, and how to handle a member demoting or unsubcribing?
If there isn’t, I’d be happy to help contributing to something (and be corrected where I may have gone wrong)
Hopefully this feedback is constructive as I don’t mean to come accross as just complaining.
Check out this example call that the WP plugin uses:
This should allow you to get whatever you need about your patron, by using the patron’s token.
If you arent having your users log into your website, then you will need to include the relevant fields as a relation through the member resource though.