So, here’s the flow.
- User links their Patreon on our site
- We store their access and refresh tokens plus expiry_date
- We check if the user is a member of OUR campaign
Step 3 is the tricky part.
I’m testing the API in Insomnia (like Postman), and I’m having trouble navigating the relationships between memberships and campaigns.
Example, I want to do: https://www.patreon.com/api/oauth2/v2/identity?include=memberships&fields[member]=patron_status&fields[member][campaign]=url,pledge_url
Which gives me:
{
"data": {
"attributes": {},
"id": "145142623",
"relationships": {
"memberships": {
"data": [
{
"id": "90248b2b-0b4e-434b-83bc-2628ffa07b0b",
"type": "member"
}
]
}
},
"type": "user"
},
"included": [
{
"attributes": {
"patron_status": "active_patron"
},
"id": "90248b2b-0b4e-434b-83bc-2628ffa07b0b",
"type": "member"
}
],
"links": {
"self": "https://www.patreon.com/api/oauth2/v2/user/145142623"
}
}
Get their patron_status and check if their subscribed campaign’s URL matches ours. I figure there should be a better way to do this – like storing the ID of our Patreon campaign and checking if a user’s memberships are subscribed to our ID.
But, I can’t even pull out associated Campaign data from the API. I tried doing something like fields[member][campaign]=url,pledge_url
this in the URL params, hoping it’d return attributes of a user’s subscribed campaigns.
Can someone tell me what I’m missing?