Function deleteInvoice
Description
Deletes an invoice along with all its line items. This operation is permanent and cannot be undone.
Important notes
- Only idInvoice parameter is required
- All invoice items are deleted automatically
- KSEF record for this invoice is also deleted (if exists)
- Cannot delete invoices already sent to KSEF
- Deletion is permanent - there is no undo
- Consider using setInvoiceStatus to mark invoice as cancelled instead
Arguments
- params :
array ( // === REQUIRED === [ 'idInvoice' ] = string, // Invoice ID (32 char GUID) )
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 invoice $params = array(); $params['idInvoice'] = '00000004M1G221031126JF1B44ASNQ6D'; $ret = $udds->deleteInvoice($params); // $ret['status'] == 'OK' on success // $ret['idInvoice'] = deleted invoice ID // $ret['deletedInvoiceNumber'] = invoice number (e.g., "0001/01/2026") // $ret['deletedItemsCount'] = number of items that were deleted
Returns
Success response
{
"status": "OK",
"idInvoice": "00000004M1G221031126JF1B44ASNQ6D",
"deletedInvoiceNumber": "0001/01/2026",
"deletedItemsCount": 3,
"errors": []
}
Error response
{
"status": "ERROR",
"errors": [
{ "code": 1003, "message": "Nie moΕΌna usunΔ
Δ faktury wysΕanej do KSEF (numer: 1234-5678-90)" }
]
}
Error codes
| Code | Description |
|---|---|
| 1001 | Missing idInvoice parameter |
| 1002 | Invoice not found |
| 1003 | Invoice already sent to KSEF (cannot delete) |
| 1007 | Database error |
Related endpoints
- createInvoiceHead - Create invoice
- updateInvoiceHead - Update invoice header
- setInvoiceStatus - Change status (alternative to deletion)
- deleteInvoiceItem - Delete single item
- getInvoice - Get invoice details
- getInvoiceList - List invoices