i have this error while using the api to create an invoice.
string '{"code":1002,"message":"Devis n’existe pas."}' (length=47)
Here is my code:
<?php
$invoice = array(
'customer_id' => '382119000000065031',
'contact_persons' => array("382119000000065031"),
'invoice_number' => 'TEST-00001',
'reference_number' => '123456',
'template_id' => '382119000000051135',
'date' => '2015-11-23',
'payment_terms' => 0,
'payment_terms_label' => 'Pagadero a la recepcion',
'due_date' => '2015-11-28',
'discount' => '0%',
'is_discount_before_tax' => true,
'discount_type' => 'item_level',
'is_inclusive_tax' => false,
'exchange_rate' => 0.103627,
'recurring_invoice_id' => '',
'invoiced_estimate_id' => '',
'salesperson_name' => '',
'custom_fields' => array(),
'line_items' => array(
array(
'item_id'=>'382119000000051159',
'project_id'=>'',
'expense_id'=>'',
'salesorder_item_id'=>'',
'name'=>'GATE-IN',
'description'=>'',
'item_order'=> 1,
'rate'=>241.25,
'unit'=>'CONTAINER',
'quantity'=>2.0,
'discount'=>0.0,
'tax_id'=>''
)
),
'payment_options' => array('payment_gateways' => array()),
'allow_partial_payments' => true,
'custom_body' => '',
'custom_subject' => '',
'notes' => 'T.C. $ 9,65',
'terms' => '',
'shipping_charge' => 0.0,
'adjustment' => 0.0,
'adjustment_description' => '',
'reason' => ''
);
$jsonInvoice = json_encode($invoice);
$url = 'https://invoice.zoho.com/api/v3/invoices';
$data = array(
'authtoken' => '[My Token]',
'JSONString' => $jsonInvoice,
"organization_id" => '[My ID]',
"send" => 'false'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded") );
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
?>
Thanks for help.