0
votes

I am integrating my application with with Quickbook Online Sandbox account using php sdk version 3. I am able to connect and fetch/add data like customers without a problem. But I am unable to create an invoice using the sdk. Here is my code:

$invoiceObj = new IPPInvoice();
$Line = new IPPline(); 
$Line->Amount = 15; 
$Line->DetailType = 'SalesItemLineDetail'; 
$saleItemLineDetail = new IPPSalesItemLineDetail(); 
$saleItemLineDetail->ItemRef = 1; 
$saleItemLineDetail->UnitPrice = 15; 
$saleItemLineDetail->Qty = 2; 
$Line->SalesItemLineDetail = $saleItemLineDetail; 
$invoiceObj->Line = $Line; 
$invoiceObj->DocNumber = '23713';
$invoiceObj->TxnDate = 2015-10-11;
$invoiceObj->CustomerRef = 67;
try{ 
  $resultingInvoiceObj = $connect->Add($invoiceObj);
} catch (Exception $e){ 
  echo $e->getMessage(); 
 }

I am writing this in a function which takes the connection object as parameter. I am able to add customer using this connection object in the same function.

The response i'm getting is

2015-04-22 06:46:15 - E:\wamp\www\test\application\libraries\QuickBooksOnline\DataService\DataService.php - 340 - CheckNullResponseAndThrowException - Response Null or Empty

I got stuck here. Please point out where i am doing wrong. Any help in this regard is highly appreciated.

1
You might want to expand on how $connect is configured. - Samuel Parkinson
Invoice add is writen in a fnction which takes Quickbooks DataService object as parameter. $connect is my DataService object in this function. I can add customer using this but i am unable to add invoice. - Ranabir
The error you're seeing probably contains an inner exception, and the inner exception itself contains a collection "InnerExecptions". Examine these to get more information on the actual cause(s) of your problem. Also, the exceptions are of the class "Intuit.Ipp.Exception.IdsException." Hope this helps! - Sandy Gettings

1 Answers

0
votes

Try this once to pass customerRef

$customerRef2            = new IPPReferenceType();

$customerRef2->value     = "67";

$invoiceObj->CustomerRef = $customerRef2;