Search code examples
phpquickbooksquickbooks-onlineintuit-partner-platform

How to add phone number in quickbook vendor?


I am unable to add primaryPhone, AlternativePhone, PrimaryEmailAddr, WebAddr and, BillAddr in vendor. Is any thing wrong to pass value to vendor api? Please help me how to pass this value.

    $dataService = QuickbookConnection::createQBConnection();
    $serviceType = IntuitServicesType::QBO;

    $vendObj = new IPPVendor();

    $vendObj->SyncToken         = $vendData['contactID'];
    $vendObj->GivenName         = $vendData['fName'];
    $vendObj->FamilyName        = $vendData['lName'];
    $vendObj->DisplayName       = $vendData['cName'];   
    $vendObj->CompanyName       = $vendData['cName'];   
    $vendObj->PrimaryPhone      = $vendData['phone'];
    $vendObj->AlternatePhone    = $vendData['altPhone'];
    $vendObj->PrimaryEmailAddr  = $vendData['email'];
    $vendObj->WebAddr           = $vendData['web'];
    $vendObj->BillAddr          = $vendData['address'] ." ". $vendData['citystate'];        
    $vendObj->Active            = true;

    $resultingObj = $dataService->Add($vendObj);        
    $QbVendorID = $resultingObj->Id;

Solution

  • All the above mentioned properties are complex types. See- https://developer.intuit.com/docs/api/accounting/Vendor

    PrimaryEmailAddr has a Child attribute 'Address' Same way all other above fields have child attribute which need to be set instead of the top property name.