I have sent a letter to the
https://www.patreon.com/api/oauth2/v2/identity?include=memberships
The request was sent, but the response reads
{
"data": {
"attributes": {},
"id": "79505248",
"relationships": {
"memberships": {
"data": []
}
},
"type": "user"
},
"links": {
"self": "https://www.patreon.com/api/oauth2/v2/user/79505248"
}
}
I think this was responded to in another post. Make sure that you have the scope for memberships in that user’s token, and also request what fields do you want like this:
public $access_token;
public function __construct( $access_token ) {
$this->access_token = $access_token;
}
public function fetch_user() {
// We construct the old return from the new returns by combining /me and pledge details
$api_return = $this->__get_json( "identity?include=memberships.currently_entitled_tiers,memberships.campaign&fields[user]=email,first_name,full_name,image_url,last_name,thumb_url,url,vanity,is_email_verified&fields[member]=currently_entitled_amount_cents,lifetime_support_cents,campaign_lifetime_support_cents,last_charge_status,patron_status,last_charge_date,pledge_relationship_start,pledge_cadence" );
$creator_id = get_option( 'patreon-creator-id', false );
$campaign_id = get_option( 'patreon-campaign-id', false );
if ( isset( $api_return['included'][0] ) AND is_array( $api_return['included'][0] ) ) {
// Iterate through included memberships and find the one that matches the campaign.
foreach ($api_return['included'] as $key => $value) {