QuickBooks Online API:用于创建帐单的行项目

时间:2018-09-23 14:05:07

标签: php api quickbooks quickbooks-online

我正在使用以下代码在QuickBooks在线中创建账单。

// Prep Data Services
$dataService = DataService::Configure(array(
    'auth_mode' => 'oauth2',
    'ClientID' => "Q0fXL014zAv3wzmlhwXMEHTrKepfAshCRjztEu58ZokzCD5T7D",
    'ClientSecret' => "stfnZfuSZUDay6cJSWtvQ9HkWiKFbcI9YuBTET5P",
    'accessTokenKey' =>
    'eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..37nFpM9YGugRpmZrNQLEYA.3Y6BM-X1k_0EUbBUFAWwXq9y46ZONCZ40sCUHTMmYc93Qf5c2ytcP8Q3ZFrSe9yBK6xGZ4J9VeMyh2QqgWFLrNyz3mqd9fShfgXZRS_kxCMEDZ-m94YS89F8xOP4smIVztlv7bucqj8osDKC52YJC1gi_P7SJoW3uSXOwwhHUARcWnyHsR7Upz4DJ8-yO0n7JWipiHBKdDagMygBIb6GtJ1244jgwE9vND4HiALkCBYrhsh4qWrXyBWKXB_4UWsM-QAIl-YCNszWp6VxFNn4Cyh-kOUNxgHpe9pa5Rt6DbcF6WD_T0MYR8S5srEIs7BisEwY7xstXJbIY_U8qIOZh9LwsQAsaXulJuWl7I4xWQ0yK5H6EEsksa3ZoaS_xeZE1KrHvMbKjHu3diDGAQFgJ9_uRjJWDElh7JT1t56HHCqkpYeNXY6oAXipqTf2Y1DZDlho6lRLBT6ss38XKEJ8aFpI5V3JbyziiVaFbhqPOIi-MD69JK7ItFhsnt2QZkdYZIqBhq1LeeCtmD6lXJSQtyqk3eghBX1uWbeCx4ue4UbyvkhD1QNY4yFqhCIXwPkcCkiDdry8YbchYnmrJ9eh7DU85H5r0YZOewAWYpQ9y_u6QHRdNNr0Otd6mXL7zpDZliQB65czbR479QmYjHqSBmpMwUn3LrvELxrQz2Wyib8fwyA_xQYTJr3w0pUiCtT_.fhIAms_p2AstZBBW6KIkhQ',
    'refreshTokenKey' => "L011530994357pUIdF4rZSpMC5XCZ2TV4ypu4pOpfen4VRvYzl",
    'QBORealmID' => "193514611894164",
    'baseUrl' => "Development"
));
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
$dataService->throwExceptionOnError(true);
//Add a new Vendor
$theResourceObj = Bill::create([
    "Line" =>
    [
        [
            "Id" => "1",
            "Amount" => 200.00,
            "DetailType" => "AccountBasedExpenseLineDetail",
            "AccountBasedExpenseLineDetail" =>
            [
                "AccountRef" =>
                [
                    "value" => "7"
                ]
            ]
        ]
    ],
    "VendorRef" =>
    [
        "value" =>"56"
    ]
]);

上面的代码针对供应商创建了帐单,但是我还需要为帐单添加订单项。我从“发票创建”中复制了以下代码以创建订单项。

"Line" => [
   [
     "Amount" => 100.00,
     "DetailType" => "SalesItemLineDetail",
     "SalesItemLineDetail" => [
       "ItemRef" => [
         "value" => 20,
         "name" => "Hours"
        ]
      ]
      ]
    ]

添加上述代码时出现以下错误。

Required param missing, need to supply the required value for the APIRequired parameter Line.DetailType is missing in the request

要使这项功能有效,必须对订单项代码进行什么更改?

0 个答案:

没有答案