UDDS OX API - documentation ver.2.5 (2023-04-07) ( www.dlaoperatora.pl )

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

CodeDescription
1001Missing required parameter idInvoice
1002Invoice with given ID does not exist in FAKTURY table
1003Missing KSeF Service configuration (serverUrl or apiKey)
1004Connection error to KSeF Service
1005KSeF Service response error

KSeF Service error codes (in ksefResponse.message)

CodeDescription
REST-001Unauthorized - invalid API key
REST-002Bad request - missing body
REST-003KSeF not initialized
REST-004Missing required parameter
REST-006Missing invoice ID
REST-009Database connection error
REST-010Processing error
REST-011KSEF_FAKTURY record not found
REST-014System exception