I cant add an invoice with the api.
I use curl in php for my school project.
Does somebody see something wrong in this?
$arrayproduct = array(“product_key” => “ITEM”, “notes”=> “TEST” , “cost”=> 15, “qty” => 1);
$arr = array("client_id" => $client_id, "invoice_items" => $arrayproduct);
$arrjson = json_encode($arr);
$ch = curl_init('localhost/ninja/public/api/v1/invoices');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $arrjson);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($arrjson),
'X-Ninja-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxx',
));
$result = curl_exec($ch);