Function deleteInvoiceItem
Description
Deletes an invoice line item. Automatically recalculates invoice totals after deletion.
Important notes
- Only idItem parameter is required
- Invoice totals (RAPORT_*, DO_ZAPLATY_*, SLOWNIE) are updated automatically after deletion
- Cannot delete items from invoices already sent to KSEF
- Deletion is permanent - there is no undo
- If all items are deleted, invoice totals will be set to 0
Arguments
- params :
array ( // === REQUIRED === [ 'idItem' ] = string, // Item ID (32 char GUID from createInvoiceItem) )
Example
require_once ( 'classUddsOx.php' ) ; $udds = new classUddsOx ; $udds->customerCode = [your_customerCode] ; $udds->login = [your_login] ; $udds->password = [your_password] ; $udds->serverUrl = 'http://api.dlaoperatora.pl/udds/' ; // Delete item $params = array(); $params['idItem'] = 'ABCD1234EFGH5678IJKL9012MNOP3456'; $ret = $udds->deleteInvoiceItem($params); // $ret['status'] == 'OK' on success // $ret['idItem'] = deleted item ID // $ret['idInvoice'] = parent invoice ID // $ret['deletedItemName'] = name of the deleted item
Returns
Success response
{
"status": "OK",
"idItem": "ABCD1234EFGH5678IJKL9012MNOP3456",
"idInvoice": "00000004M1G221031126JF1B44ASNQ6D",
"deletedItemName": "Usลuga konsultingowa",
"errors": []
}
Error response
{
"status": "ERROR",
"errors": [
{ "code": 1002, "message": "Pozycja o ID 'XXX' nie istnieje" }
]
}
Error codes
| Code | Description |
|---|---|
| 1001 | Missing idItem parameter |
| 1002 | Item not found |
| 1003 | Invoice not found (parent invoice deleted?) |
| 1004 | Invoice already sent to KSEF (cannot modify) |
| 1007 | Database error |
Related endpoints
- createInvoiceItem - Create new item
- updateInvoiceItem - Update existing item
- getInvoice - Get invoice with items
- createInvoiceHead - Create invoice header
- getInvoiceList - List invoices