Question

I'm using the PHP SDK for the Quickbooks Online v3 API. I'm running query through DataService and QueryMessage that returns an array of objects, that contains entire customer-specific records. Name/addresses/phone numbers/balance due/overdue balance etc.

Everything works just fine, however a key is given "TotalRevenue" and its value is always returned as "NULL". I've played with the test data on QuickBooks Online, created several pre-dated transactions, and its always NULL regardless. I can, however, manipulate Balance, OverDueBalance, and other accounting-related fields. What is the problem with TotalRevenue? I suspect Quickbooks has turned it off, for some reason...but I'd like confirmation :)

edit: I checked Quickbooks' Online API Explorer, and in their returns, it does not return "TotalRevenue" at all when querying the Customer table.

code:

    // Prep Data Services
    $dataService = new DataService($serviceContext);

    // Build a query
    $oneQuery = new QueryMessage();
    $oneQuery->sql = "SELECT";
    $oneQuery->entity = "Customer";
    $oneQuery->orderByClause = "FamilyName";
    $oneQuery->startposition = "1";
    $oneQuery->maxresults = "50";

    // Run a query
    $queryString = $oneQuery->getString();
    $entities = $dataService->Query($queryString);

    // Echo some formatted output
    var_dump($entities);

var_dump outputs:

    [0]=>
  object(IPPCustomer)#29 (62) {
    ["Taxable"]=>
    string(4) "true"
    ["BillAddr"]=>
    object(IPPPhysicalAddress)#68 (16) {
      ["Id"]=>
      string(4) "55555"
      ["Line1"]=>
      string(22) "123 ABC St"
      }

      ...

    ["Notes"]=>
    string(20) "These are some notes"
    ["Job"]=>
    string(5) "false"
    ["BillWithParent"]=>
    string(5) "false"

    ... 

    ["Balance"]=>
    string(5) "40.00"
    ["OpenBalanceDate"]=>
    NULL
    ["BalanceWithJobs"]=>
    string(5) "40.00"
    ["CreditLimit"]=>
    NULL
    ["AcctNum"]=>
    NULL
    ["CurrencyRef"]=>
    NULL
    ["OverDueBalance"]=>
    NULL
    ["TotalRevenue"]=>
    NULL   //<-----Why is this always NULL if there are transactions (both expenses
           //      and revenue) made from and to the customers?

    ...

    ["GivenName"]=>
    string(4) "John"
    ["MiddleName"]=>
    string(6) "Middle"
    ["FamilyName"]=>
    string(10) "Doe"

    ...
Was it helpful?

Solution

V3 PHP devkit is a wrapper on top of QBD and QBO API.

'TotalRevenue' is for QBD. QBD REST APIs are depricated. In future PHP devkit releases, this field will not present. Please ignore this field.

Ref - https://developer.intuit.com/docs/95_deprecated/qbd_v3/qbd_v3_reference/030_entity_services_reference/customer

As you have mentioned, this field is not present for QBO V3.

Ref - https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/customer

Thanks

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top