Delete invoice by ID. The invoice is marked as deleted and, as in Mango: its payments are released, credit note is reverted on the original invoice, the linked cost is deleted, the invoice is unlinked from orders and stock movements are cancelled. Invoice already sent as e-invoice can not be deleted. Methods DELETE, POST or PUT.
https://rest.crmango.com/api/DeleteInvoice
Bearer
varchar
Auth token
invoice_id
integer
Invoice id (required)
Delete invoice by ID
code
integer
Return code
message
varchar
Info message
invoice_id
integer
Id of the deleted invoice
curl --request DELETE \
--url 'https://rest.crmango.com/api/DeleteInvoice' \
--header 'Authorization: Bearer auth_token' \
--header 'Content-Type: application/json' \
--data '{
"data": {
"invoice_id": 21
}
}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://rest.crmango.com/api/DeleteInvoice',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_POSTFIELDS => '{
"data": {
"invoice_id": 21
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer auth_token',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
var data = JSON.stringify({
"data": {
"invoice_id": 21
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("DELETE", "https://rest.crmango.com/api/DeleteInvoice");
xhr.setRequestHeader("Authorization", "Bearer auth_token");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);
import requests
import json
url = "https://rest.crmango.com/api/DeleteInvoice"
payload = json.dumps({
"data": {
"invoice_id": 21
}
})
headers = {
'Authorization': 'Bearer auth_token',
'Content-Type': 'application/json'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
{
"code": 200,
"message": "Invoice has been deleted",
"invoice_id": 21
}
{
"code": "int",
"message": "string"
}