0

我正在使用 zoho 图书 api。我正在使用以下代码创建发票:-

$url = "https://books.zoho.com/api/v3/invoices";
$headers = array(
   "Authorization:" . $zoho_token,
   "Content-Type:  application/x-www-form-urlencoded",
);
$data = array(
          "customer_id" => "my-customer-id",
          "line_items" => array(
             array(
                 "name" => "Test Product",
                 "rate" => 10,
                 "quantity" => 5,
                 "tax_percentage"=>5,
                 "item_total" => 52.5
             ),
          ),
          "date" => date("Y-m-d"),
   );
   $jsonData = "&JSONString=" . urlencode(json_encode($data));
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
   curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
   curl_setopt($ch, CURLOPT_POST, TRUE);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
   $urlData = json_decode(curl_exec($ch));
   echo "<pre>";
   print_r($urlData);

添加了发票,但仍在我的 zoho 帐户 tax_percentage 和 item_total 上未添加自动显示 item_total。因此未在 item_total 中添加税。

4

1 回答 1

0

而不是添加tax_percentage,提供tax_id。它会工作

于 2017-08-29T16:24:34.780 回答