Using the answer above I managed to solve the issue, this was the GQL.
$query = <<
and the PHP to read it:
```php
foreach($data['data']['company']['locations']['edges'] as $location){
if($location['node']['buyerExperienceConfiguration']['paymentTermsTemplate'] !== null) {
$is_on_credit = true;
}
}