我正在使用zoho books 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上没有自动添加show_total。所以税项未在item_total中添加。
答案 0 :(得分:0)
不是添加tax_percentage
,而是提供tax_id
。它会起作用