Function sendInvoiceToKsef
Description
Sends an invoice to the National e-Invoice System (Krajowy System e-Faktur) via external KSeF Service.
Important notes
Arguments
array(
['idInvoice'] = string // Invoice ID from FAKTURY table (min. 9 characters)
)
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/';
$params = array();
$params['idInvoice'] = '00000004M1G221031126JF1B44ASNQ6D';
$ret = $udds->sendInvoiceToKsef($params);
Returns
Success response
{
"status": "OK",
"message": "Faktura wysłana do KSeF",
"idInvoice": "00000004M1G221031126JF1B44ASNQ6D",
"errorCode": null,
"ksefResponse": {
"httpCode": "200",
"message": "Faktura wysłana do KSeF",
"status": "ok"
}
}
Error response
{
"status": "ERROR",
"message": "Błąd wysyłki do KSeF",
"idInvoice": "00000004M1G221031126JF1B44ASNQ6D",
"errorCode": 1005,
"ksefResponse": {
"httpCode": "404",
"message": "REST-003: KSeF nie jest zainicjowany",
"status": "error"
}
}
Error codes
| Code | Description |
| 1001 | Missing required parameter idInvoice |
| 1002 | Invoice with given ID does not exist in FAKTURY table |
| 1003 | Missing KSeF Service configuration (serverUrl or apiKey) |
| 1004 | Connection error to KSeF Service |
| 1005 | KSeF Service response error |
KSeF Service error codes (in ksefResponse.message)
| Code | Description |
| REST-001 | Unauthorized - invalid API key |
| REST-002 | Bad request - missing body |
| REST-003 | KSeF not initialized |
| REST-004 | Missing required parameter |
| REST-006 | Missing invoice ID |
| REST-009 | Database connection error |
| REST-010 | Processing error |
| REST-011 | KSEF_FAKTURY record not found |
| REST-014 | System exception |