Prva stran 
Nazaj 
Naprej 
Novosti 
 Kopiraj povezavo na to stran 
 
Natisni stranNatisni stran  
e-računi navodila za up...  >  Spletne storitve in int...  >  API Reference  >  SalesInvoice API

SalesInvoice API

Please check the API reference documentation for SalesInvoiceAPI here https://e-racuni.com/obracuni/ApiDocumentation https://e-racuni.com/obracuni/ApiDocumentation.

SalesInvoiceAPI exposes the functionality of the invoicing GUI to developer. Most of invoice editing features are available via API methods in this category. The API user account needs to own the same privileges as the regular GUI to get access to features via the API.

Below you will find examples on how to use the invoicing API. Some examples are written using JSON request notation, some examples are written in XML and some examples use curl command line tool to illustrate multiple way on how you can use the API.

Please use the API developer panel to generate API request source in a language of your preference. JSON, XML, Linux command line and PHP request source can be automatically generated by the API developer panel tool.

API developer panel is available at:

https://e-racuni.com/obracuni/developer https://e-racuni.com/obracuni/developer

Creating a simple invoice

Here is a simple example on how to create an invoice with two items using JSON API request. The item price is given as net price excluding VAT which will be added automatically using the general VAT rate.

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "SalesInvoiceCreate",
       "parameters": {
               "SalesInvoice": {
                       "dateOfSupplyFrom": "2022-10-13",
                       "buyerName": "Janez Novak",
                       "buyerStreet": "Glavna ulica 123",
                       "buyerPostalCode": "2000",
                       "buyerCity": "Maribor",
                       "buyerEMail": "janez.novak@gmail.com",
                       "buyerPhone": "01/1234567",
                       "Items": [
                               {
                                   "description": "Prva storitev",
                                   "quantity": 5.0,
                                   "unit": "h",
                                   "netPrice": 100.0
                               },
                               {
                                   "description": "Opis druge storitve",
                                   "quantity": 3,
                                   "unit": "h",
                                   "netPrice": 50.0
                               }
                       ]
               }
       }
}


Creating a fiscalized invoice

In order to issue a fiscalized invoice you need to ensure that you have previously correctly setup and activated a fiscalized business unit and the master settings of the application. Also check the list of payment methods available for invoicing.

Example below shows how to make a fiscalized invoice for a received Stripe payment. The invoice is of type Retail  which means that price is meant to be the final price paid by the customer (price including all taxes).

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "SalesInvoiceCreate",
       "parameters": {
               "SalesInvoice": {
                       "dateOfSupplyFrom": "2022-10-13",
                       "buyerName": "Tone Novak",
                       "buyerEMail": "tone.novak@gmail.com",
                       "type": "Retail",
                       "methodOfPayment": "Stripe",
                       "cashRegisterCode": "0001",
                       "Items": [
                               {
                                   "description": "Stripe purchase",
                                   "quantity": 1.0,
                                   "unit": "kom",
                                   "price": 250.0
                               }
                       ]
               }
       }
}


Creating a simple invoice using special vat margin scheme for selling second hand goods

Here is a simple example on how to create an invoice with two items using JSON API request when using using special vat margin scheme for selling second hand goods. First item's vat transaction type is set to 101 which means "Special vat margin calculation for used goods / Posebna ureditev za rabljeno blago", this VAT transaction type has to be used when selling second hand goods and using special VAT margin scheme.

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "SalesInvoiceCreate",
       "parameters": {
               "SalesInvoice": {
                       "dateOfSupplyFrom": "2022-10-13",
                       "buyerName": "Janez Novak",
                       "buyerStreet": "Glavna ulica 123",
                       "buyerPostalCode": "2000",
                       "buyerCity": "Maribor",
                       "buyerEMail": "janez.novak@gmail.com",
                       "buyerPhone": "01/1234567",
                       "Items": [
                               {
                                   "description": "Slika Mona Lise",
                                   "quantity": 1.0,
                                   "unit": "kos",
                                   "netPrice": 1000.0,
                                   "vatTransactionType": 101,
                                   "purchaseAmount": 266.0
                               },
                               {
                                   "description": "Stroški posredovanja",
                                   "quantity": 3,
                                   "unit": "h",
                                   "netPrice": 30.0
                               }
                       ]
               }
       }
}


Fiscalization of invoices is completely automatic and is outside of control of the user or the API. Based on tax regulations the application will automatically fiscalize and report all invoices that need fiscalization to the tax office

Creating an invoice for selling products

If you have defined a master list of products and pricing for the products, then you can create invoice simply by specifying product code (SKU) and quantity. See example below:

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "SalesInvoiceCreate",
       "parameters": {
               "SalesInvoice": {
                       "dateOfSupplyFrom": "2022-10-13",
                       "buyerName": "Janez Novak",
                       "buyerEMail": "janez.novak@gmail.com",
                       "Items": [
                               {
                                   "productCode": "0000100",
                                   "quantity": 1.0
                               },
                               {
                                   "productCode": "0000240",
                                   "quantity": 1.0
                               }
                       ]
               }
       }
}


Be aware that issuing of invoice might fail if the products are not on stock and company settings are set to deny negative stock quantities on the warehouse. Issuing an invoice with stock tracking item will also trigger automatic issuing of delivery note on a warehouse associated with the invoice.

How to create credit note for partial or full refund

Here is a simple example on how to create credit note for partial or full refund of invoice above with two items using JSON API request.

In case of creating full refund credit note, we just use method SalesInvoiceCreateCreditNote and specify parameter for number of invoice, that are we creating refund for:

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
        "method": "SalesInvoiceCreateCreditNote",
        "parameters": {
                "number": "2022-00005"
        }
}


Partial refund (we refund only amount from second item from simple invoice above). Import is to use "salesInvoiceRef" property, to reference sales invoice for which we are creating credit note for refund:

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "CreditNoteCreate",
       "parameters": {
               "CreditNote": {
                       "dateOfSupplyFrom": "2022-10-13",
                       "buyerName": "Janez Novak",
                       "buyerStreet": "Glavna ulica 123",
                       "buyerPostalCode": "2000",
                       "buyerCity": "Maribor",
                       "buyerEMail": "janez.novak@gmail.com",
                       "buyerPhone": "01/1234567",
                       "salesInvoiceRef": "2022-00005",
                       "Items": [
                               {
                                   "description": "Opis druge storitve",
                                   "quantity": 3,
                                   "unit": "h",
                                   "netPrice": 50.0
                               }
                       ]
               }
       }
}


Printing invoices/Downloading of invoice PDF

Once the invoice is issued you can get the PDF of the invoice by specifying the invoice date and number or by specifying the invoice document ID which is returned in response of the SalesInvoiceCreate API call. Example:

POST https://e-racuni.com/WebServicesSI/API
Content-Type: application/json

{
       "username": "MICKA",
       "md5pass": "1234567890a1c85dc0c1234218acb900",
       "token": "1234562ADC3A123001234D00B0C71E0EC",
       "method": "SalesInvoiceGetPDF",
       "parameters": {
               "documentID": "60:3913326"
       }
}


In the example above, the PDF of the invoice will be returned as part of the JSON response with BASE64 encoding. If you want to download PDF more efficiently then you should directly download PDF by setting the method parameter downloadFile  to true. Example of API call using curl to directly download PDF from command line:

curl -OJ https://e-racuni.com/WebServicesSI/API-CLI/SalesInvoiceGetPDF \
 -u MICKA:12345678C3A70D0012312312312312_12312312312312312312312 \
 -d documentID='"60:3913326"' \
 -d downloadFile=true


Notes on API invoicing context

In order to create an invoice you need to either pre-set the user account with the context of the invoice or specify the context via the API call.

Similar to application behavior in the GUI, the API invoicing context is defined by:

fiscal yearyou need to specify fiscal year if you are issuing invoices outside of the current fiscal year
business unitif multiple business units are defined, then the BU of the account will be used, or you need to specify the BU with your API call
cost center/cost positionif cost centers are used the default cost center will be set if not specified by the API call
warehouseif multiple warehouses are available the default WH of the BU/CC will be used if not specified by the API call. The warehouse determines the type of the invoice regarding pricing, either Retail (B2C) where VAT is included in the price, or Gross (B2B) with pricing excluding VAT.
currencydefault FY currency will be used as invoicing currency if not specified by the API call
cashRegisterCodecode (ID) of the cash register of the fiscalized invoice. Cash register assignment must be made for all cash invoices which are subject to fiscalization in Slovenia.
document languageInvoices will be issued in the default language or according to the settings of the cost center, or the client if document language is specified there. Set invoicing language explicitly if you need to override the default settings.
document currencyInvoices will be issued with the default currency valid for the fiscal year, or according to the settings of the cost center, or the client/buyer if document currency is specified there. Set document currency explicitly if you need to override the default settings.


Getting an invoice with SalesInvoiceGet (or POS invoice with POSSalesInvoiceGet)

Get sales invoice or POS sales invoice by document number, or by combination of document number and date. User can select output format which is used for generating the invoice data file. By default, internal format is used as defined by the SalesInvoice API datatype. Please see external documentation for the eSLOG electronic invoice format.


Example request and response in XML

(For internal "XML" format)

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceGet">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2009-12-15" />
</method>
</request>

Response
HTTP/1.1 200 OK
Server: e-racuni.com web server
Date: Tue, 1 March 2016 11:00:05 GMT
Content-Type: text/xml
Content-Length: 328

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
       <SalesInvoice>
               <businessYear>2016</businessYear>
               <buyerCode>123456</buyerCode>                   <!-- (Optional). If buyer code is specified, other buyer parameters bellow are not needed as the buyer data is taken from database. If any additional parameter is specified, it will override master buyer data in document
               <buyerCity>RADOVLJICA</buyerCity>
               <buyerCountry>SI</buyerCountry>
               <buyerName>5 FIVER d.o.o.</buyerName>
               <buyerPostalCode>4240</buyerPostalCode>
               <buyerStreet>ULICA 22</buyerStreet>
               <buyerTaxNumber>75882442</buyerTaxNumber>
               <buyerVatRegistration>None</buyerVatRegistration>
               <city>Maribor</city>
               <costPosition>1</costPosition>
               <cashRegisterCode>0001</cashRegisterCode>  <!-- This property must be set for fiscalization
               <businessUnit>0001</businessUnit>          <!-- This property must be set for fiscalization
              <orderReference>123</orderReference>                    <!-- (Optional)
               <vatBook>123</vatBook>
               <advanceInvoicesRef>2014-00001, 2014-00002, 2014-00003</advanceInvoicesRef> <!-- references to advance invoices
               <salesQuoteRef>2014-00001</salesQuoteRef> <!-- reference to sales quote
               <salesOrdersRef>2014-00001, 2014-00002</salesOrdersRef> <!-- references to sales orders
               <deliveryNotesRef>2014-00004, 2014-00005, 2014-00006</deliveryNotesRef> <!-- references to delivery notes
               <creditNotesRef>2014-00004</creditNotesRef> <!-- references to credit notes
               <debitNotesRef>2014-00001, 2014-00002</debitNotesRef> <!-- references to debit notes
               <cancelledDocumentRef>2016-00015</cancelledDocumentRef> <-- Reference to cancelled document
               <date>2016-02-19</date>
               <dateOfSupplyFrom>2016-02-19</dateOfSupplyFrom>
               <paymentDueDate>2016-03-06</paymentDueDate>
               <invoicePricingType>retail</invoicePricingType>
               <isReccurringInvoice>0</isReccurringInvoice>
               <number>2016-00002</number>             <!-- document number optional AUTO numbering
               <vatTransactionType>0</vatTransactionType>
               <vatOutgoingDocumentVatClause>Registered</vatOutgoingDocumentVatClause>
               <status>issuedInvoice</status>
               <totalAmount>90.00</totalAmount>
               <amountAlreadyPaid>50.00</amountAlreadyPaid>
               <amountLeftToBePaid>40.00</amountLeftToBePaid>
               <totalAmount>289.860</totalAmount>
               <totalCurrency>EUR</totalCurrency>
               <totalDiscount>0.0</totalDiscount>
               <totalNetAmount>243.87</totalNetAmount>
               <totalVatAmountFlatRate>0.00</totalVatAmountFlatRate>
               <totalVatAmountNormalRate>44.00</totalVatAmountNormalRate>
               <totalVatAmountLowerRate>1.99</totalVatAmountLowerRate>
               <totalVatAmountZeroRate>0.0</totalVatAmountZeroRate>
               <totalVatBaseAmountFlatRate>0.00</totalVatBaseAmountFlatRate>
               <totalVatBaseAmountNormalRate>200.00</totalVatBaseAmountNormalRate>
               <totalVatBaseAmountLowerRate>20.87</totalVatBaseAmountLowerRate>
               <totalVatBaseAmountZeroRate>23.00</totalVatBaseAmountZeroRate>
               <methodOfPayment>bankTransfer</methodOfPayment>
               <reference>05 11290</reference>                         <!-- generated reference number
               <referenceUPN>SI12 2012000093805</referenceUPN>         <!-- generated reference number for UPN payment order
               <eor>34facd65-622b-745d-a541-30ab1f9d3ac1</eor>  <!-- generated by FURS
               <zoi>a7e5f55e1dbb48b799268e1a6d8618a3</zoi>      <!-- generated when issuing document if it is for fiscalization    
               <fiscalNumber>1</fiscalNumber>                   <!-- fiscal sequential number for fiscal numbering of document
               <introductionText>introduction text</introductionText>
               <vatCountryIsoCode>HR</vatCountryIsoCode>
               <warehouseCode>00001</warehouseCode>
               <Address>                        <!-- (Optional) Setting delivery address on document and partner buyer if it doesn't exists              
                       <city>Celje</city>
                       <country>SI</country>
                       <postalCode>3000</postalCode>
                       <street>Ulica 10</street>
                       <type>Delivery</type>
                       <firstAddressLine>Delivery address</firstAddressLine>
               </Address>
               <Items>
                       <Item>
                               <amount>23.00</amount>
                               <amountWithoutDiscount>23.00</amountWithoutDiscount>
                               <currency>EUR</currency>
                               <description>dfhf</description>
                               <discountAmount>0.0</discountAmount>
                               <discountPercentage>0.0000</discountPercentage>
                               <netPrice>18.85246</netPrice>
                               <netPriceInDocumentCurrency>23.00000</netPriceInDocumentCurrency>
                               <position>3</position>
                               <price>23.00000</price>
                               <priceInDocumentCurrency>23.00000</priceInDocumentCurrency>
                               <quantity>1.000000</quantity>
                               <totalDiscountPercentage>0.0000</totalDiscountPercentage>
                               <vatAmount>0.00</vatAmount>
                               <vatPercentage>0.0</vatPercentage>
                               <vatTransactionType>8</vatTransactionType>
                               <costPosition>1</costPosition>
                               <chartAccountNumber>76000</chartAccountNumber>
                       </Item>
                       <Item>
                               <amount>20.87</amount>
                               <amountWithoutDiscount>20.87</amountWithoutDiscount>
                               <currency>BOB</currency>
                               <description>asdgdas</description>
                               <discountAmount>0.0</discountAmount>
                               <discountPercentage>0.0000</discountPercentage>
                               <netPrice>195.43379</netPrice>
                               <netPriceInDocumentCurrency>20.87277</netPriceInDocumentCurrency>
                               <position>2</position>
                               <price>214.00000</price>
                               <priceInDocumentCurrency>22.85568</priceInDocumentCurrency>
                               <quantity>1.000000</quantity>
                               <totalDiscountPercentage>0.0000</totalDiscountPercentage>
                               <vatAmount>1.99</vatAmount>
                               <vatPercentage>9.5</vatPercentage>
                               <costPosition>1</costPosition>
                               <chartAccountNumber>76000</chartAccountNumber>
                       </Item>
                       <Item>
                               <amount>200.00</amount>
                               <amountWithoutDiscount>200.00</amountWithoutDiscount>
                               <articleCode>0155-ART</articleCode>
                               <articleName>testni art</articleName>
                               <currency>EUR</currency>
                               <description></description>
                               <discountAmount>0.0</discountAmount>
                               <discountPercentage>0.0000</discountPercentage>
                               <netPrice>100.00000</netPrice>
                               <netPriceInDocumentCurrency>100.00000</netPriceInDocumentCurrency>
                               <position>1</position>
                               <price>122.00000</price>
                               <priceInDocumentCurrency>122.00000</priceInDocumentCurrency>
                               <productCode>0155-ART</productCode>
                               <productName>testni art</productName>
                               <quantity>2.000000</quantity>
                               <totalDiscountPercentage>0.0000</totalDiscountPercentage>
                               <vatAmount>44.00</vatAmount>
                               <vatPercentage>22.0</vatPercentage>
                               <costPosition>1</costPosition>
                               <chartAccountNumber>76000</chartAccountNumber>
                       </Item>
               </Items>
               <PaymentRecords>
                       <PaymentRecord>
                               <paymentAmount>20.000</paymentAmount>
                               <paymentCurrency>EUR</paymentCurrency>
                               <paymentDate>2016-03-09</paymentDate>
                               <paymentEntryTS>2016-03-09 15:36:33</paymentEntryTS>
                               <paymentMethodForInvoice>BankPaymentOrder</paymentMethodForInvoice>
                       </PaymentRecord>
               </PaymentRecords>
               <SalesInvoiceInstallments>
                       <Installment>
                               <installmentAmount>200.000</installmentAmount>
                               <installmentDate>2016-03-09</installmentDate>
                               <position>1</position>
                       </Installment>
                       <Installment>
                               <installmentAmount>89.000</installmentAmount>
                               <installmentDate>2016-03-23</installmentDate>
                               <position>2</position>
                       </Installment>
               </SalesInvoiceInstallments>
       </SalesInvoice>
</response>

Response (on error)
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="document could not be found"><error/>
</response>


(For ESLOG format)

POST /WebServicesSI/API HTTP/1.1
Host: e-racuni.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceGet">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2009-12-15" />
       <parameter name="format" value="ESLOG" />
</method>
</request>


Response
<?xml version="1.0" encoding="windows-1250"?>
<IzdaniRacunEnostavni xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.gzs.si/e-poslovanje/sheme/eSlog_1-4_PreprostiRacun.xsd">
       <Racun>
               <GlavaRacuna>
                       <VrstaRacuna>380</VrstaRacuna>
                       <StevilkaRacuna>2</StevilkaRacuna>
                       <FunkcijaRacuna>9</FunkcijaRacuna></GlavaRacuna>
               <DatumiRacuna>
                       <VrstaDatuma>137</VrstaDatuma>
                       <DatumRacuna>20160219</DatumRacuna></DatumiRacuna>
               <DatumiRacuna>
               ...
       </Racun>
</IzdaniRacunEnostavni>



SalesInvoiceGetUPNPDF

Get PDF for sales invoice with UPN payment order by document number, or by combination of document number and date. User can also decide if he wants UPN in top or bottom of pdf document. Response (on OK) returns binary record for PDF file coded with Base64 coding.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: e-racuni.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceGetUPNPDF">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2009-12-15" />
        <parameter name="paymentOrderPosition">top<parameter/> <!--- posible values: top, bottom
</method>
</request>


Response
<response status="ok">
       <number>2012-01293</number>
       <date>2013-01-02</date>
       <pdfFile>JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nJVYS4/bNh...</pdfFile>
</response>

Response (on error)
<response status="error">
       <error description="Can not find sales invoice for number: 2013-01293 and date: 2013-01-02">
       </error>
</response>


SalesInvoiceGetPublicURL

Get URL link for accessing the document via web or mobile browser. This link can be sent to the customer instead of PDF attachment. Upon clicking the link a document viewer for the invoice will be opened with option for downloading the PDF invoice.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: e-racuni.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceGetPublicURL">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2009-12-15" />
        <parameter name="markDocumentAsSent" />
        <parameter name="linkExpirationDate" value="2020-12-31" />
</method>
</request>


Response
<response status="ok">
       <number>2012-01293</number>
       <date>2013-01-02</date>
       <publicURL>https://racuni.com/racuni/SI-123123123489AADEFABC123</publicURL>
</response>

Response (on error)
<response status="error">
       <error description="Cannot find sales invoice for number: 2013-01293 and date: 2013-01-02">
       </error>
</response>


SalesInvoiceImport

Import Sales invoice which was already issued in other ERP system. Import is made for purposes of accounting. Invoices can be imported using API datatype format or in the form of a standardized eSLOG XML format (or any other supported electronic invoice format).

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceImport">
               <parameter name="importType" value="createOrUpdate" />
               <parameter name="SalesInvoice">
                    <!-- structure of elements is the same as in SalesInvoiceCreate only tag <number> is mandatory here
                <parameter/>
       </method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <number>0001-1206-2014</number>
       <date>2013-06-12</date>
</response>

Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
        <error description="Property <number> is required."><error/>  <!-- missing number  
</response>

Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
                <error description="Sales invoice for number: 0001-1206-2013 already exists!"></error>  <!-- Sales Invoice for number already exists  
</response>

(Using ESLOG data format)

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceImport">
               <parameter name="importType" value="createOrUpdate" />
               <parameter name="dataFormat" value="ESLOG" />
               <parameter name="base64data">JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+Cn...
                    <!-- eSlog XML encoded into base64 string
                <parameter/>
       </method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <number>0001-1206-2014</number>
       <date>2021-06-12</date>
</response>

Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
                <error description="Parameter <base64data>: cannot parse contents"></error>  <!-- Error when decoding XML from base64 string  
</response>

<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
                <error description="Error parsing XML file due to invalid syntax"></error>  <!-- Error when parsing XML
</response>

<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
                <error description="Document can not be overwritten because it is already posted."></error>  <!-- There are several different error messages possible.
</response>



SalesInvoiceUpdate

Update existing Sales invoice. Data must contain sales invoice number to be able to identify document which is to be updated.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceUpdate">
<parameter name="SalesInvoice">
         <number>12</number>                                    <!-- document number is mandatory in UPDATE (Can use sequential document number (example: 12), or formatted number (example: 12/2011))
               <!--  Parameters are identical to the parameters in SalesInvoiceCreate api
       </parameter>
</method>
</request>

Response
HTTP/1.1 200 OK
Server: e-racuni.com web server
Date: Tue, 1 March 2016 11:00:05 GMT
Content-Type: text/xml
Content-Length: 328
<?xml version="1.0" encoding="utf-8"?>
response status="ok" >
       <number>12/2009</number>                <!-- created document ID or number
       <date>2016-01-13</date>                 <!-- date of document
</response>

Response (on error)
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>          <!-- missing mandatory attributes, invalid values, no privileges,  
</response>


SalesInvoiceDelete

Delete sales order. Must specify parameter/s (number, number+date) to identify document for deleting. It is possible to delete only last issued invoice.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceDelete">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2016-01-13" />
</method>
</request>

Response
HTTP/1.1 200 OK
Server: e-racuni.com web server
Date: Tue, 1 March 2016 11:00:05 GMT
Content-Type: text/xml
Content-Length: 328

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
</response>

Response (on error)
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="no privileges"><error/>     <!-- document could not be found, no privileges,  
</response>



SalesInvoiceCancel

Cancel sales invoice (annulment of the invoice by creating a reverse invoice).

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceCancel">
       <parameter name="number" value="2013-00014" />
       <parameter name="date" type="Date" value="2013-03-26" />
       <parameter name="status" value="draft" />
</method>
</request>

Response
HTTP/1.1 200 OK
Server: e-racuni.com web server
Date: Tue, 1 March 2016 11:00:05 GMT
Content-Type: text/xml
Content-Length: 328

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
</response>

Response (on error)
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="Access denied. User account does not have sufficient privileges for the given request"><error/>     <!-- document could not be found, no privileges,  
</response>

Response (on error)
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="Can not cancel sales invoice for arguments number: 2013-00014 date: 2013-03-26"><error/>    <!-- document could not be canceled,  
</response>

Possible error messages:
Access denied. User account does not have sufficient privileges for the given request
Parameter named "number" is required
Can not find sales invoice for number
Can not cancel. Found X sales invoices
Found X sales invoices X. You can only cancel one sales invoice at a time
Can not cancel sales invoice X



SalesInvoiceList and POSSalesInvoiceList

Get list of sales invoices or POS sales invoices for criteria which is specified by API parameters.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceList">
               <parameter name="status" value="issuedInvoice" />
               <parameter name="dateFrom" type="Date" value="2016-02-19" />
       </method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
<SalesInvoices>                 
       <SalesInvoice>
                <!-- structure of elements is the same as in SalesInvoiceGet
       </SalesInvoice>
       ...
</SalesInvoices>
</response>


Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>          <!-- no privileges,  
</response>


SalesInvoiceSendByEmail

Sends document by email to the recipient(s).


Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceSendByEmail">
       <parameter name="number" value="12/2009" />
       <parameter name="date" type="Date" value="2016-01-13" />
       <parameter name="sender" value="micka@kovac.com"/>
       <parameter name="recipient" value="zoran@kovac.com,zlatko@kovac.com"/>
       <parameter name="cc" value=""/>
       <parameter name="bcc" value=""/>
       <parameter name="subject" value="TEST d.o.o.: Sales invoice nr. 0002/2016"/>
       <parameter name="message" value="Message text"/>
        <parameter name="useHtmlMessage" value="true"/>
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
</response>


Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="no privileges"><error/>     <!-- document could not be found, no privileges, mail sending failed
</response>


SalesInvoicePaymentRecordAdd

Record payment of the invoice.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoicePaymentRecordAdd">
       <parameter name="number" value="2014-00013"/>
       <parameter name="date" type="Date" value="2014-05-15"/>
       <parameter name="paymentDate" type="Date" value="2014-05-20"/>
       <parameter name="paymentAmount" value="50"/>
       <parameter name="paymentMethodForInvoice" value="Cash"/>
       <parameter name="paymentRemark" value="Payment record on sales invoice 2014-05-15"/>
       <parameter name="paymentCurrency" value="EUR"/>
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
</response>


Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="Payment method Test is not supported"><error/>      <!-- wrong payment method chosen
</response>


SalesInvoiceInstallmentsCreate

Define installments on sales invoice (payment of the invoice with multiple installments).

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
       <method name="SalesInvoiceInstallmentsCreate">
               <parameter name="number" value="2014-00013"/>
               <parameter name="date" type="Date" value="2014-05-15"/>
               <parameter name="SalesInvoiceInstallments">
                       <SalesInvoiceInstallments>
                               <Installment>
                                       <installmentDate>2014-06-15</installmentDate>
                                       <installmentAmount>218</installmentAmount>
                               </Installment>
                               <Installment>
                                       <installmentDate>2014-07-15</installmentDate>
                                       <installmentAmount>300</installmentAmount>
                               </Installment>
                               <Installment>
                                       <installmentDate>2014-08-15</installmentDate>
                                       <installmentAmount>300</installmentAmount>
                               </Installment>
                       </SalesInvoiceInstallments>
               </parameter>
       </method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <message>Succesfuly added 3 installments to sales invoice.</message>
       <number>2014-00013</number>
    <date>2014-05-15</date>
</response>


Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="None or only one instalment specified."><error/>    <!-- at least two installments must be specified
</response>

Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description="No instalments were added to sales invoice!"><error/>       <!-- no installments added to sales invoice
</response>


SalesInvoiceAttachmentAdd

Add image/attachment to a sales invoice.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceAttachmentAdd">
       <parameter name="number" type="String" value="2020-00001" />
       <parameter name="attachment">
               <contents encoding="BASE64">BASE64...</contents>
               <fileName>att.jpg</fileName>
       </parameter>
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <message>Successfully added attachment att.jpg to sales invoice 2020-00001.</message>
</response>
Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>  <!-- Possible errors:  Access denied. User account does not have sufficient privileges for the given request, Parameter named <number> is required, Can not find sales invoice for number: 2020-00001, Parameter <attachment> is missing, Parameter <attachment> cannot parse contents
</response>


SalesInvoiceAttachmentSetDefault

Add file attachment to a sales invoice and set is as default attachment (the first file attached).

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceAttachmentSetDefault">
       <parameter name="number" type="String" value="2020-00001" />
       <parameter name="attachment">
               <contents encoding="BASE64">BASE64...</contents>
               <fileName>att.jpg</fileName>
       </parameter>
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <message>Successfully added attachment att.jpg to sales invoice 2020-00001.</message>
</response>
Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>  <!-- Possible errors:  Access denied. User account does not have sufficient privileges for the given request, Parameter named <number> is required, Can not find sales invoice for number: 2020-00001, Parameter <attachment> is missing, Parameter <attachment> cannot parse contents
</response>


SalesInvoiceAttachmentGet

Get default attachment of a sales invoice.


Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceAttachmentGet">
       <parameter name="number" type="String" value="2020-00001" />
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <SalesInvoice>
               <Attachments>
                       <Attachment>
                               <fileName>att.jpg</fileName>
                               <contents encoding="BASE64">BASE64</contents>
                       </Attachment>
               </Attachments>
       </SalesInvoice>
</response>
Response on error
<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>  <!-- Possible errors:  Access denied. User account does not have sufficient privileges for the given request, Parameter named <number> is required, Can not find sales invoice for number: 2020-00001 Sales invoice does not have attachemnts.
</response>


SalesInvoiceAttachmentList

Get all images/files attached to the invoice.

Example request and response

POST /WebServicesSI/API HTTP/1.1
Host: eurofaktura.com
User-Agent: Mozilla/4.0
Content-Length: 410
Content-Type: application/octet-stream

<?xml version="1.0" encoding="utf-8"?>
<request>
<login username="micka" md5pass="ddb43e9f119c6805f4770ecc4f6466ba" token="E7DF3E6E94FB4579BBA8F54979010B5C" />
<method name="SalesInvoiceAttachmentList">
       <parameter name="number" type="String" value="2020-00001" />
</method>
</request>

Response
<?xml version="1.0" encoding="utf-8"?>
<response status="ok" >
       <SalesInvoice>
               <Attachments>
                       <Attachment>
                               <fileName>att1.jpg</fileName>
                               <contents encoding="BASE64">1BASE64</contents>
                       </Attachment>
                       <Attachment>
                               <fileName>att2.jpg</fileName>
                               <contents encoding="BASE64">2BASE64</contents>
                       </Attachment>
                       <Attachment>
                               <fileName>att3.jpg</fileName>
                               <contents encoding="BASE64">3BASE64</contents>
                       </Attachment>
               </Attachments>
       </SalesInvoice>
</response>

Response on error

<?xml version="1.0" encoding="utf-8"?>
<response status="error" >
       <error description=""><error/>  <!-- Possible errors:  Access denied. User account does not have sufficient privileges for the given request, Parameter named <number> is required, Can not find sales invoice for number: 2020-00001 Sales invoice does not have attachemnts.
</response>

Reference na stran

---
Zadnja sprememba 16.10.2024 9:01:21
© E-RAČUNI d.o.o. 2003-2024