here is my request , but get error . i’m trying to created an invoice from this API.
from API documentation , i have try to get this. i’m wrong somewhere
<?
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$currency=3;
$number=124560;
$billing_street="Lagos";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://domain/api/invoices/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array(
"customer_id" => 2180,
"date" => $date,
"currency" => $currency,
"allowed_payment_modes" => array("1", "2", "3", "4", "5", "6"),
"number" => $number,
"subtotal" => $subtotal,
"total" => $total,
"billing_street" => $billing_street,
"newitems" => array(
[
{ "id": '1',
"rel_id": "2",
"rel_type": "invoice",
"description": "12MP Dual Camera with cover",
"long_description": "The JBL Cinema SB110 is a hassle-free soundbar",
"qty": "2.00",
"rate": "5.00",
"unit": "CBM",
"item_order": "1"
}
{
"id": "2",
"rel_id": "2",
"rel_type": "invoice",
"description": "CCTV CAMERA",
"long_description": "hikvision full color camera",
"qty": "1.00",
"rate": "5.00",
"unit": "",
"item_order": "2"
}
]
),
),
CURLOPT_HTTPHEADER => array(
"Authtoken: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1Ni0"
),
));
curl_exec($curl);
curl_close($curl);
?>
when trying i geting error, HTTP 500 Error , i’m new in json php . please i need your help
here is the api documentation https://perfexcrm.themesic.com/apiguide/#api-Invoices-PostInvoice