In this blog, I explain how to add customer, get a customer and also update customer using the QuickBooks API v3 in c#.


  "Customer": {
    "PrimaryEmailAddr": {
      "Address": ""
    "SyncToken": "0", 
    "domain": "QBO", 
    "GivenName": "Bill", 
    "DisplayName": "Bill's Windsurf Shop", 
    "BillWithParent": false, 
    "FullyQualifiedName": "Bill's Windsurf Shop", 
    "CompanyName": "Bill's Windsurf Shop", 
    "FamilyName": "Lucchini", 
    "sparse": false, 
    "PrimaryPhone": {
      "FreeFormNumber": "(415) 444-6538"
    "Active": true, 
    "Job": false, 
    "BalanceWithJobs": 85.0, 
    "BillAddr": {
      "City": "Half Moon Bay", 
      "Line1": "12 Ocean Dr.", 
      "PostalCode": "94213", 
      "Lat": "37.4307072", 
      "Long": "-122.4295234", 
      "CountrySubDivisionCode": "CA", 
      "Id": "3"
    "PreferredDeliveryMethod": "Print", 
    "Taxable": false, 
    "PrintOnCheckName": "Bill's Windsurf Shop", 
    "Balance": 85.0, 
    "Id": "2", 
    "MetaData": {
      "CreateTime": "2014-09-11T16:49:28-07:00", 
      "LastUpdatedTime": "2014-09-18T12:56:01-07:00"
  "time": "2015-07-23T11:04:15.496-07:00"


Add Customer

Request Body

The minimum elements to create a Customer are listed here.

  "FullyQualifiedName": "Bhavdip Talaviya", 
  "PrimaryEmailAddr": {
    "Address": ""
  "DisplayName": "Bhavdip Talaviya", 
  "Suffix": "Jr", 
  "Title": "Mr", 
  "MiddleName": "B", 
  "Notes": "Here are other details.", 
  "FamilyName": "Talaviya", 
  "PrimaryPhone": {
    "FreeFormNumber": "(555) 555-5555"
  "CompanyName": "vision", 
  "BillAddr": {
    "CountrySubDivisionCode": "CA", 
    "City": "Mountain View", 
    "PostalCode": "94042", 
    "Line1": "123 Main Street", 
    "Country": "USA"
  "GivenName": "Bhavdip"

Now I add the customer using the C# code.

Customer _customer = new Customer();
_customer.GivenName = "Bhavdip";
_customer.CompanyName = "Vision";
_customer.ContactName = "Bhavdip Talaviya";
_customer.FamilyName = "Talaviya";

TelephoneNumber _PrimaryPhone = new TelephoneNumber();
_PrimaryPhone.FreeFormNumber = "(555) 555-5555";
_customer.PrimaryPhone = _PrimaryPhone;

TelephoneNumber _Mobile = new TelephoneNumber();
_Mobile.FreeFormNumber = "9898989898";
_customer.Mobile = _Mobile;

TelephoneNumber _Fax = new TelephoneNumber();
_Fax.FreeFormNumber = "123456";
_customer.Fax = _Fax;

EmailAddress _Email = new EmailAddress();
_Email.Address = "";
_customer.PrimaryEmailAddr = _Email;

PhysicalAddress _BillAddr = new PhysicalAddress();
_BillAddr.CountrySubDivisionCode = "CA";
_BillAddr.PostalCode = "94042";
_BillAddr.Country = "USA";
_BillAddr.Line1 = "123 Main Street";
_BillAddr.City = "Mountain View";
_customer.BillAddr = _BillAddr;

_customer.Active = true;
Customer _customerAdded = dataService.Add(_customer);

you get the added customer response in the  _customerAdded so you can see or update to your DB.

Get Customer


Select * From Customer

you can also make the query as you like below :

get customer by LastUpdatedTime: select * from Customer Where Metadata.LastUpdatedTime > ‘2015-03-01’

get customer by ID: Select * From Customer where Id = ‘1’

You need Realmid and AccessTocken for the get any data from the QuickBooks.

Now I get the all customer using the C# code.

var realmid="add here your realm id";
var AccessTocken="add here your AccessTocken";

QueryService<Customer> QueryService = new QueryService<Customer>(GetContext(realmid, AccessTocken));
List<Customer> _getcustomer = QueryService.ExecuteIdsQuery("Select * From Customer").ToList();

you get the customer response in the _getcustomer variable so you can store this data into your DB.

Update Customer

In update customer, you need Quickbooks inserted Id and also SyncToken which get when the customer added.


  • Id

    Datatype: string
    Unique identifier for this object. Sort order is ASC by default.
  • SyncToken

    Datatype: string
    The version number of the object. It is used to lock an object for use by one app at a time. As soon as an application modifies an object, its SyncToken is incremented. Attempts to modify an object specifying older SyncToken fails. Only the latest version of the object is maintained by QuickBooks Online.

Now I update the customer using the C# code.

Customer _customer = new Customer();
_customer.CompanyName = "Vision";

TelephoneNumber _PrimaryPhone = new TelephoneNumber();
_PrimaryPhone.FreeFormNumber = "(666) 666-6666";
_customer.PrimaryPhone = _PrimaryPhone;

EmailAddress _Email = new EmailAddress();
_Email.Address = "";
_customer.PrimaryEmailAddr = _Email;

_customer.Id = "1";
_customer.SyncToken = "1";

Customer _customerUpdated = dataService.Update(_customer);

you get the updated customer response in the _customerUpdated so you can see or update to your DB.

you can not delete the customer in QuickBooks online, you can update this customer as In-active like below:
_customer.Active = false;

so In this blog, I explained add customer, update customer and also get customers.





Footer Logo


Select Categories