I used following code in xero API to generate an invoice. I want to know is this the correct way to pass 'unitdp' parameter with the request?
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.xero.com/api.xro/2.0/Invoices?unitdp=4',
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 =>'{
"Invoices":[
{
"Type":"ACCREC",
"Contact":{
"ContactID":"'.$session->CONTACT_ID.'"
},
"LineItems":'.$lineItems.',
"Date":"'.date("Y/m/d").'",
"DueDate":"'.date("Y/m/d").'",
"Status":"AUTHORISED",
"Reference":"Stripe Payout"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Content-Type: application/json',
'Authorization: Bearer '.$session->XERO_ACCESS_TOKEN,
),
));
I was trying to get rounded values but it didn't work. For an example if I have 54.54545454 I want 54.5454 in invoice