Im working on a project to give a code from my website to active patreon members (unique to each member.) The user is authorizing my site as follows (this is working successfully)
$href = 'https://www.patreon.com/oauth2/authorize?response_type=code&client_id=' . $client_id . '&redirect_uri=' . urlencode($redirect_uri);
$scope_parameters = '&scope=member%20identity'.urlencode('[email]');
$href .= $scope_parameters;
echo '<a href="'.$href.'">Click here to login via Patreon</a>';
at the redirect_uri I am getting the access token from the user. I am then looking at the info from the access token as follows:
$api_client = new API($access_token);
$patron_response = $api_client->fetch_user(["include" => ["pledges"]]);
When I look at $patron_response it includes all memberships the user has ever had, with no obvious way for me to iterate through the array to find my campaign. What am I missing? Ideally I would only get the membership info for my campaign, or at least have someway to identify which one of the campaigns in the ‘included’ array was the campaign I am interested in. any pointers would be appreciated.