Customer Data API
In the invoice responses, we can locate Customer Reference data, which includes the qualified customer name and its ID in the value attribute. Additional data related to the invoiced service, such as the billing or delivery address, is also provided. For our purposes, this may be sufficient to connect a customer with their address.
It is important to note, however, that the billing and delivery addresses in the invoice response reflect the information assigned to the customer at the time the invoice was created. These addresses may differ from the customer's current address when generating the report discussed in this article.
To obtain up-to-date customer and address information, we should use the Customer Data API, which can be explored here. Querying customer data can also be tested in the following documentation section:
After fetching the necessary invoices, we can use the associated Customer IDs to execute queries and retrieve specific customer data:
select * from Customer Where id IN ('1', '2', '4')
With the result:
{
"QueryResponse": {
"Customer": [
{
"Taxable": true,
"BillAddr": {
"Id": "2",
"Line1": "4581 Finch St.",
"City": "Bayshore",
"CountrySubDivisionCode": "CA",
"PostalCode": "94326",
"Lat": "INVALID",
"Long": "INVALID"
},
"ShipAddr": {
"Id": "2",
"Line1": "4581 Finch St.",
"City": "Bayshore",
"CountrySubDivisionCode": "CA",
"PostalCode": "94326",
"Lat": "INVALID",
"Long": "INVALID"
},
"Job": false,
"BillWithParent": false,
"Balance": 239,
"BalanceWithJobs": 239,
"CurrencyRef": {
"value": "USD",
"name": "United States Dollar"
},
"PreferredDeliveryMethod": "Print",
"IsProject": false,
"ClientEntityId": "0",
"domain": "QBO",
"sparse": false,
"Id": "1",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2024-12-06T16:48:43-08:00",
"LastUpdatedTime": "2024-12-13T13:39:32-08:00"
},
"GivenName": "Amy",
"FamilyName": "Lauterbach",
"FullyQualifiedName": "Amy's Bird Sanctuary",
"CompanyName": "Amy's Bird Sanctuary",
"DisplayName": "Amy's Bird Sanctuary",
"PrintOnCheckName": "Amy's Bird Sanctuary",
"Active": true,
"V4IDPseudonym": "0020984269d61f380843669fe5bd7044f5ff0d",
"PrimaryPhone": {
"FreeFormNumber": "(650) 555-3311"
},
"PrimaryEmailAddr": {
"Address": "Birds@Intuit.com"
}
},
{
"Taxable": false,
"BillAddr": {
"Id": "3",
"Line1": "12 Ocean Dr.",
"City": "Half Moon Bay",
"CountrySubDivisionCode": "CA",
"PostalCode": "94213",
"Lat": "37.4307072",
"Long": "-122.4295234"
},
"Job": false,
"BillWithParent": false,
"Balance": 85,
"BalanceWithJobs": 85,
"CurrencyRef": {
"value": "USD",
"name": "United States Dollar"
},
"PreferredDeliveryMethod": "Print",
"IsProject": false,
"ClientEntityId": "0",
"domain": "QBO",
"sparse": false,
"Id": "2",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2024-12-06T16:49:28-08:00",
"LastUpdatedTime": "2024-12-13T12:56:01-08:00"
},
"GivenName": "Bill",
"FamilyName": "Lucchini",
"FullyQualifiedName": "Bill's Windsurf Shop",
"CompanyName": "Bill's Windsurf Shop",
"DisplayName": "Bill's Windsurf Shop",
"PrintOnCheckName": "Bill's Windsurf Shop",
"Active": true,
"V4IDPseudonym": "0020987f7bbe58b72a4343bc45437a189f23f2",
"PrimaryPhone": {
"FreeFormNumber": "(415) 444-6538"
},
"PrimaryEmailAddr": {
"Address": "Surf@Intuit.com"
}
},
{
"Taxable": false,
"BillAddr": {
"Id": "5",
"Line1": "321 Channing",
"City": "Palo Alto",
"CountrySubDivisionCode": "CA",
"PostalCode": "94303",
"Lat": "37.443231",
"Long": "-122.1561846"
},
"Job": false,
"BillWithParent": false,
"Balance": 0,
"BalanceWithJobs": 0,
"CurrencyRef": {
"value": "USD",
"name": "United States Dollar"
},
"PreferredDeliveryMethod": "Print",
"IsProject": false,
"ClientEntityId": "0",
"domain": "QBO",
"sparse": false,
"Id": "4",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2024-12-06T16:52:08-08:00",
"LastUpdatedTime": "2024-12-06T16:52:08-08:00"
},
"GivenName": "Diego",
"FamilyName": "Rodriguez",
"FullyQualifiedName": "Diego Rodriguez",
"DisplayName": "Diego Rodriguez",
"PrintOnCheckName": "Diego Rodriguez",
"Active": true,
"V4IDPseudonym": "002098bfad66f678f04c12815ec338f55556e5",
"PrimaryPhone": {
"FreeFormNumber": "(650) 555-4477"
},
"PrimaryEmailAddr": {
"Address": "Diego@Rodriguez.com"
}
}
],
"startPosition": 1,
"maxResults": 3
},
"time": "2025-01-10T03:18:11.010-08:00"
}
The up-to-date billing address is now available, and the presence of the companyName field allows us to distinguish between business customers (B2B) and individual customers (B2C). With this data in hand, all prerequisites for building the custom reporting tool are fulfilled.