eu fiz assim, para teste:
function auth() {
$ch = curl_init();
$requestURL = 'https://api-pix-h.gerencianet.com.br/oauth/token';
$cliendId = ''; //seu client id
$clientSecret = ''; //seu client secret
$authorization = base64_encode($cliendId . ":" . $clientSecret);
$certFile = ''; //o caminho do certificado
$arr = ['grant_type' => 'client_credentials'];
$headers = [];
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Basic ' . $authorization;
curl_setopt($ch, CURLOPT_URL, $requestURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arr));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSLCERT, $certFile);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
$resposta = json_decode($result);
if (curl_errno($ch)) {
die('Erro: ' . curl_error($ch));
}
curl_close($ch);
return $resposta->access_token;
}