Hi.
I’m trying to get my patrons’ details on PHP. To achieve this, I installed patreon-php package, and create this function:
$access_token = 'my-access-token';
$api_client = new API($access_token);
$campaigns_response = $api_client->fetch_campaigns();
$campaign_id = $campaigns_response['data'][0]['id'];
$patrons = $api_client->fetch_page_of_members_from_campaign($campaign_id, 25);
$patrons_with_details = [];
foreach ($patrons['data'] as $patron) {
$id = $patron['id'];
$details = $api_client->fetch_member_details($id);
array_push($patrons_with_details, $details);
}
return $patrons_with_details;
It returns my patrons but doesn’t provide any details but user id and tier. I tried to change the suffix in fetch_member_details function to get more data of a member based on the documentation. On the documentation page, it has been suggested using the URL down below to get the other fields.
https://www.patreon.com/api/oauth2/v2/members/03ca69c3-ebea-4b9a-8fac-e4a837873254?include=address,currently_entitled_tiers,user&fields[member]=full_name,is_follower,email,last_charge_date,last_charge_status,lifetime_support_cents,patron_status,currently_entitled_amount_cents,pledge_relationship_start,will_pay_amount_cents&fields%5Btier%5D=title&fields%5Buser%5D=full_name,hide_pledges
But using this link’s suffix part returns an error:
{"errors":[
{
"code":1,
"code_name":"Bad Request",
"detail":"Error trying to decode a non urlencoded string. Found invalid characters: {']', '['} in the string: 'include=address,currently_entitled_tiers,user&fields[member]=full_name,is_follower,email,last_charge_date,last_charge_status,lifetime_support_cents,patron_status,currently_entitled_amount_cents,pledge_relationship_start,will_pay_amount_cents&fields%5Btier%5D=title&fields%5Buser%5D=full_name,hide_pledges'. Please ensure the request/response body is x-www-form-urlencoded.","id":"eba2f989-8a95-49c1-8f80-08d4306a6205",
"status":"400",
"title":"Bad Request"
}
]}
I hope someone can help me with this.
Thanks.