Create Invoice
Create Invoice
This command enables applying a digital signature on the transaction data received from the taxpayer's invoicing
system. It provides non-repudiation of the signed invoice, i.e. the taxpayer cannot deny the content of the invoice
nor that the invoice was signed using his/her secure element.
Endpoints
NOTE:
Development, testing and technical review are all done in the Sandbox environment. The next step is the
administrative review process which enables getting accreditation for a specific country. Different countries have
different environment names, and every environment has its own URL. See Environments.
V-SDC https://vsdc.sandbox.suf.purs.gov.rs//api/v3/invoices
https://vsdc.sandbox.taxcore.online/api/
E-SDC http://<ESDC_ip_address>:<ESDC_port>/api/v3/invoices
http://192.168.88.112:8888/api/v3/invoic
Method
POST
Authentication
V-SDC
Use client digital certificate for authentication with each request to V-SDC.Api.
E-SDC
E-SDC does not require client authentication.
Request
Headers
Headers
Add following HTTP headers to each request
• Accept: application/json
• Content-Type: application/json
• RequestId: <RequestId_value> (Unique identifier of the request, generated by POS system. It is
used only for later request search, in case a response was not received. - optional). MaxLength: 32
• Accept-Language: <Accept-Language_value> (The list of one or more languages returned
through the field supportedLanguages in the Get Status service response, ordered in POS language
preference and separated by semi-colon.)
o SDC returns Invoice Result in the first supported language from the list
o if none of the languages from the list are supported by SDC, the SDC returns HTTP status code
406
o if POs does not submit this parameter, SDC returns Invoice Result in the first language from the
list obtained through Get Status service
• PAC: <PAC_value> (PAC value for the provided client authentication certificate - only for V-SDC)
Invoice
referentDocumentNumber Mandatory for all Copies and Mandatory only in case Invoice
Refunds and some Normal Sale or Type is Refund, Copy or Advance
Advance Sale invoices Sale connected to an Advance Sale
(other jurisdiction-specific rules may
apply). In all cases, this field must
contain Invoice Number of the
previously issued invoice. In any
other case this field is optional.
ASCII, in the requestedBy-
signedBy-Ordinal_Number format.
Unicode MaxLength: 50
Key: omitTextualRepresentation
Value: "1" to omit generation of
textual representation by E-SDC and
"0" to generate return textual
representation to POS.
Textual representation of an invoice
(journal) must be submitted to the
tax authority as part of an audit
package.
Item
Each Item represents one line item on the invoice.
gtin Optional Global Trade Item Number (GTIN) is an identifier for trade items,
incorporated the ISBN, ISSN, ISMN, IAN (which includes the
European Article Number and Japanese Article Number) and
some Universal Product Codes, into a universal number space.
unitPrice Mandatory Unit price of the line item. It does not take part in tax calculation.
labels Mandatory The array of labels. Each Label represents one of the Tax Rates
applied on the invoice item. Tax Items are calculated based on
totalAmount and applied labels as described in the Calculate
Taxes section. This field is mandatory (i.e. the caller must submit
a non-empty collection) for each item, even when the price is
0.00.
Payment
Payment
Model
InvoiceRequest {
dateAndTimeOfIssue (string, optional),
cashier (string) Unicode MaxLength:50,
buyerId (string, optional) ASCII MaxLength:20,
buyerCostCenterId (string, optional) Unicode MaxLength:50,
invoiceType (string) = ['Normal', 'ProForma', 'Copy', 'Training', 'Advance'] (int) = [0,1,2,3,
transactionType (string) = ['Sale', 'Refund'] (int) = [0,1],
payment (Array[Payment]),
invoiceNumber (string, optional) Unicode MaxLength:60,
referentDocumentNumber (string, optional),
referentDocumentDT (string, optional),
options (inline_model, optional),
items (Array[Item])
}
Payment {
amount (number),
paymentType (string) = ['Other', 'Cash', 'Card', 'Check', 'WireTransfer', 'Voucher', 'MobileMo
}
inline_model {
omitQRCodeGen (string, optional) = ["0", "1"],
omitTextualRepresentation (string, optional) = ["0", "1"]
}
Item {
gtin (string, optional) MinLength:8 MaxLength:14,
name (string) Unicode MaxLength:2048,
quantity (number) Decimal(14,3) MinValue:0.001,
labels (Array[string]) MinLength:1,
unitPrice (number) Decimal(14,2),
totalAmount (number) Decimal(14,2)
}
Response
Headers
The following HTTP headers shall be returned in response
Data Fields
Field Description
Field Description
sdcDateTime Local date and time in ISO 8601 format provided by E-SDC.
invoiceCounterExtension First letters of Invoice Type and Transaction Type of the invoice. NS for Normal
Sale, CR – Copy Refund, TS – Training Sale, etc.
verificationQRCode Base64 encoded byte array of GIF image created in the Create QR Code
process
totalCounter Total number of invoices signed by Secure Element. Returned by Sign Invoice
APDU command
transactionTypeCounter Total number of invoices for a requested type. Returned by Sign Invoice APDU
command
encryptedInternalData Base64 encoded byte array returned by Sign Invoice APDU command
signature Base64 encoded byte array returned by Sign Invoice APDU command
businessName Taxpayer Business Name obtained from digital certificate subject field
tin Tax Identification Number obtained from digital certificate subject field
district District obtained from digital certificate subject field
mrc Manufacturer Registration Code is mandatory for audit package sent to the tax
authority database, but it's optional for invoice response sent to POS. It always
has the format MakeCode-SoftwareVersionCode-DeviceSerialNumber.
Explanation: MakeCode -unique 2 characters received from the tax authority
during accreditation. SoftwareVersionCode - unique 4 characters received
from the tax authroty during accreditation. DeviceSerialNumber -
manufacturer serial number (max 32 characters) for each E-SDC installation. All
3 elements of MRC are mandatory.
messages (optional) Custom human-readable message that shall be printed or displayed by POS.
TaxItem
TaxItem represents tax liability on the invoice per one tax category.
Field Description
categoryType Tax Category Type (0 - Tax on net, 1 - Tax on total, 2 - Amount per quantity)
Model
InvoiceResult {
requestedBy (string, optional),
sdcDateTime (string),
invoiceCounter (string, read only),
invoiceCounterExtension (string, optional),
invoiceNumber (string, read only),
taxItems (Array[TaxItem], optional),
verificationUrl (string, optional),
verificationQRCode (string, optional),
journal (string, optional),
messages (string, optional),
signedBy (string),
encryptedInternalData (string),
signature (string, optional),
totalCounter (integer, optional),
transactionTypeCounter (integer, optional),
transactionTypeCounter (integer, optional),
totalAmount (number, optional),
taxGroupRevision (integer, optional),
businessName (string, optional),
tin (string, optional),
locationName (string, optional),
address (string, optional),
district (string, optional),
mrc (string, optional)
}
TaxItem {
categoryType (integer, optional),
label (string),
amount (number),
rate (number),
categoryName (string)
}
Examples
Below are examples of invoice requests and responses for all supported invoice and transaction types:
1.
Mapping
In case POS does not use Journal (generated by E-SDC or V-SDC) as a content for a fiscal receipt, but it
generates a custom-designed receipt instead, it must use the following element mappings:
2.
Normal Sale
This is an example of Normal Sale Invoice
3.
Normal Refund
This is an example of Normal Refund
4.
Advance Sale
This is an example of Advance Sale Invoice
5.
Advance Refund
This is an example of Advance Refund.
6.
Copy Sale
This is an example of Copy Sale
7.
Copy Refund
This is an example of Copy Refund
8.
Proforma Sale
Proforma Sale
This is an example of Proforma Sale
9.
Proforma Refund
This is an example of Proforma Refund
10.
Training Sale
This is an example of Training Sale
11.
Training Refund
This is an example of Training Refund