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

Function createInvoiceHead

Description

Creates an invoice header (without line items). Line items should be added separately using createInvoiceItem endpoint.

Document Types (documentType)

Important notes

Arguments

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['issuePlace'] = 'Warszawa';
  $params['issueDate'] = date('Y-m-d');
  $params['saleDate'] = date('Y-m-d');
  $params['paymentMethod'] = 'przelew';
  $params['documentType'] = 'FV';
  $params['status'] = 'AKTYWNA';
  $params['template'] = 'VAT';
  $params['currency'] = 'PLN';
  
  $params['buyerName'] = 'Firma ABC Sp. z o.o.';
  $params['buyerAddress'] = 'ul. Przykładowa 1';
  $params['buyerCity'] = 'Warszawa';
  $params['buyerPostCode'] = '00-001';
  $params['buyerNip'] = '1234567890';
  
  $ret = $udds->createInvoiceHead($params);
  
  // $ret['status'] == 'OK' on success
  // $ret['id'] = invoice ID (32 char GUID)
  // $ret['number'] = invoice number (e.g. '0001/02/2026')

Returns

Success response

{
  "status": "OK",
  "id": "00000004M1G221031126JF1B44ASNQ6D",
  "number": "0001/02/2026",
  "errors": []
}

Error response

{
  "status": "ERROR",
  "id": null,
  "number": null,
  "errors": [
    { "code": 1001, "message": "Pole Data wystawienia (issueDate) jest wymagane" },
    { "code": 1002, "message": "Nieprawidłowa waluta. Dozwolone: PLN, EUR, USD" }
  ]
}

Error codes

CodeDescription
1001Missing required field
1002Invalid dictionary value (documentType, template, currency, calculationType)
1003Invalid date format (must be YYYY-MM-DD)
1004Bank account not found for company
1005Invoice number sequence error
1006Related document not found (for FK correction)
1007Database error

Related endpoints