Newbie Question: Am I Doing This Right? :)

I’m currently working on an e-commerce website and need to check customers against a campaign membership for the purpose of providing discounts. I started out using the Patreon PHP library version 1.x but couldn’t find a straightforward way to get this basic information (maybe I’m just missing it!), so I abandoned the library and wrote my own script:

$api_endpoint = "https://www.patreon.com/api/oauth2/v2/campaigns/".Configure::read('Patreon.campaign_id')."/members?";
$api_endpoint .= "page%5Bcount%5D=500&sort=full_name";
$api_endpoint .= "&fields%5Bmember%5D=full_name,email,last_charge_date,last_charge_status,lifetime_support_cents,currently_entitled_amount_cents,patron_status";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Patreon-PHP, version 0.3.1, platform ".php_uname('s').'-'.php_uname('r'));
$authorization_header = "Authorization: Bearer " . Configure::read('Patreon.access_token');
curl_setopt($ch, CURLOPT_HTTPHEADER, array($authorization_header));

$json_string = curl_exec($ch);
$member_response = json_decode($json_string, true);

// Show the results!
foreach ($member_response['data'] AS $member) {
    echo $member['attributes']['email'].' - '.$member['attributes']['currently_entitled_amount_cents'].'<br />';
}

This works as expected – with the exception that page count is ignored and I only get ten results.

So my questions are:

  • What should I be doing to increase pagination result count?
  • Is this the wrong approach / am I missing an obvious way to get this info using the library?

Any advice is appreciated!