quickbooks online sdk创建发票

quickbooks online sdk创建发票,sdk,quickbooks,invoice,Sdk,Quickbooks,Invoice,我正在使用quickbooks sdk连接quickbook在线帐户。我能够连接一个数据库,以获取客户和发票等数据,而不会出现问题。但是我无法使用sdk创建发票。这是我的密码: $token = unserialize($_SESSION['token']); $requestValidator = new OAuthRequestValidator( $token['oauth_token'], $token['oauth_token_secret'], OAUTH_C

我正在使用quickbooks sdk连接quickbook在线帐户。我能够连接一个数据库,以获取客户和发票等数据,而不会出现问题。但是我无法使用sdk创建发票。这是我的密码:

$token = unserialize($_SESSION['token']);
    $requestValidator = new OAuthRequestValidator(
        $token['oauth_token'], $token['oauth_token_secret'], OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET);
    $realmId = $_SESSION['realmId'];
    $serviceType = $_SESSION['dataSource'];
    $serviceContext = new ServiceContext($realmId, $serviceType, $requestValidator);

    $dataService = new DataService($serviceContext);

    //create an invoice
    $invoiceObj = new IPPInvoice();
    $invoiceObj->CustomerRef = 5;
    $invoiceObj->Amount = 12.00;
    $invoiceObj->DocNumber = 9999;
    $invoiceObj->TaxnDate = "2014-05-01";
    $Line = new IPPline();
    $Line->DetailType ='SalesItemLineDetail';
    //$Line->Amount = 10;
    $Line->setDescription = 'Test description goes here.';
    $saleItemLineDetail = new IPPSalesItemLineDetail();
    $saleItemLineDetail->ItemRef = 1;
    $saleItemLineDetail->Quantity = 1;
    $saleItemLineDetail->UnitPrice = 10.00;
    $line->SalesItemLineDetail = $saleItemLineDetail;
    $invoiceObj->Line = $line;
    $resultingInvoiceObj = $dataService->Add($invoiceObj);
当运行此操作时,未创建发票,我收到以下错误:

Fatal error: Uncaught IdsException: [0]: 2014-05-02 17:26:08 - /home/randy/test_apps/v3-php-sdk-2.0.4/DataService/DataService.php - 340 - CheckNullResponseAndThrowException - Response Null or Empty thrown in /home/randy/test_apps/v3-php-sdk-2.0.4/Core/CoreHelper.php on line 95
我认为行数据添加不正确。如何正确添加行数据或是其他数据


谢谢

您必须按如下字符串传递客户id

$invoiceObj->CustomerRef = 5;
下面是工作示例代码