Wiki source code of 3. Invoice-service

Last modified by Karl Holmbom on 2024/10/07 13:26
Hide last authors
David Persson 5.1 1 (% class="jumbotron" %)
2 (((
3 (% class="container" %)
4 (((
David Persson 6.1 5 Integrate to **PayEx Invoice service API **
David Persson 5.1 6 )))
7 )))
8
9 == Introduction ==
10
Jens Kral 55.2 11 This API is used to create new invoices on existing customers
David Persson 5.1 12
David Persson 43.1 13 [[image:1615196225210-926.png||height="100" width="390"]]
David Persson 5.1 14
David Persson 43.1 15
David Persson 5.1 16 Each resource in the API corresponds to its own route. All routes are structured according to a specific standard, explained below
17
David Persson 58.1 18 The below route is an example of a route towards resource1Id
David Persson 100.1 19 //lf-api.payex.com/ledger/**{Subdomain}**/v1/**{LedgerNumber}**/resource1/**{resource1Id}**//
David Persson 5.1 20
21 (% class="table-bordered table-striped" %)
22 |=(% style="width: 604px;" %)Route segment|=(% style="width: 2790px;" %)Description
David Persson 58.1 23 |(% style="width:604px" %)Subdomain|(% style="width:2790px" %)In this part of the API it will be **invoice-service**
David Persson 5.1 24 |(% style="width:604px" %)LedgerNumber|(% style="width:2790px" %)The ledger identifier/number at PayEx
David Persson 44.1 25 |(% style="width:604px" %)InvoiceNo|(% style="width:2790px" %)Identifier of resource invoice
David Persson 5.1 26
27 (% class="wikigeneratedid" %)
28 Routes that occurs in examples of this documentation will use the following identifiers
29
30 (% class="table-bordered table-striped" %)
31 |=(% style="width: 488px;" %)Resource|=(% style="width: 2271px;" %)Identifier
32 |(% style="width:488px" %)LedgerNumber|(% style="width:2271px" %)XXX
33 |(% style="width:488px" %)Invoices|(% style="width:2271px" %)NNN
34
Karl Holmbom 101.1 35 == ==
David Persson 38.1 36
David Persson 6.1 37 == Invoices ==
David Persson 5.1 38
David Persson 79.1 39 This resource is used to create new invoices, both debit invoices and credit invoices
David Persson 97.1 40
41 (% class="box infomessage" %)
42 (((
David Persson 96.1 43 Batches of multiple invoices should be processed sequentially towards the API. Each API call is intended for the creation of a single invoice
David Persson 97.1 44 )))
David Persson 57.1 45
David Persson 79.1 46 ==== Example of a new debit invoice ====
47
David Persson 5.1 48 {{code language="http" title="**Request**"}}
David Persson 57.1 49 POST /ledger/invoice-service/v1/XXX/invoices HTTP/1.1
David Persson 5.1 50 Host: -
51 Authorization: Bearer <Token>
52 Content-Type: application/json
53
David Persson 7.1 54 {
Eric Runer 92.1 55 "customerNo": "2992682",
56 "invoiceNo": "0000003",
57 "invoiceDate": "2021-05-15",
58 "preferredDueDate": "2021-06-15",
59 "externalInvoiceId": "900003",
60 "currency": "NOK",
61 "invoiceAddress": {
62 "addressee": "Annie Testsson",
63 "streetAddress": "Teststreet 1",
64 "zipCode": "50000",
65 "city": "Testcity",
66 "coAddress": "CO Bengtsson",
67 "countryCode": "SE"
68 },
69 "distribution": null,
70 "invoiceReason": {
71 "invoiceReasonCode": "CAS",
72 "invoiceReasonDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet"
73 },
74 "legalMonetaryTotal": {
75 "payableAmount": 97.99,
76 "vatInclusiveAmount": 98.01,
77 "vatExclusiveAmount": 98.01
78 },
79 "referenceInfo": {
80 "invoicePeriod": {
81 "startDate": "2021-04-07",
82 "endDate": "2021-04-25"
83 },
84 "deliveryInfo": {
85 "deliveryDate": "2021-04-27",
86 "deliveryAddress": {
David Persson 75.1 87 "addressee": "Namn på mottagre",
88 "streetAddress": "Testgatan 789",
89 "zipCode": "11111",
90 "city": "Sthlm",
91 "coAddress": "C/O Andersson",
92 "countryCode": "SE"
Eric Runer 92.1 93 }
94 },
95 "purchaseOrderReference": "Lorem ipsum dolor sit amet",
96 "salesOrderReference": "Lorem ipsum dolor sit amet",
97 "buyerReference": "Lorem ipsum dolor sit amet",
98 "invoicedObjectIdentifier": "Lorem ipsum do",
99 "contractReference": "Lorem ipsum dolor sit amet",
100 "despatchReference": "Lorem ipsum dolor sit amet",
101 "receiptReference": "Lorem ipsum dolor sit amet",
102 "tenderReference": "Lorem ipsum dolor sit amet",
103 "projectReference": "Lorem ipsum dolor sit amet"
104 },
105 "InvoiceNote": "InvoiceNote-Text e Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, ",
106 "invoiceSpecification": {
107 "inclVat": true,
108 "roundingAmount": -0.01,
109 "invoiceLines": [
110 {
111 "itemDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
112 "amount": 98.0,
113 "datePeriod": {
114 "StartDate": "2021-04-21",
115 "EndDate": "2021-04-25"
David Persson 75.1 116 },
Eric Runer 92.1 117 "gTIN": "156789123",
118 "itemObjectIdentifier": "itemObjectIdentifier",
119 "quantity": 1,
120 "unit": "ANN",
121 "unitPrice": 98.0,
122 "vatCategoryCode": "AE",
123 "vatRate": 10
124 },
125 {
126 "itemDescription": "Lorem ipsum dolor sit amet",
127 "amount": 0.01
128 }
129 ],
130 "invoiceVatSpecification": {
131 "vatSubTotal": [
David Persson 75.1 132 {
Eric Runer 92.1 133 "taxableAmount": 98.01,
134 "vatAmount": 0.0,
135 "vatRate": 1,
136 "vatCategoryCode": "Z"
David Persson 33.1 137 }
Eric Runer 92.1 138 ]
139 },
140 "taxCurrencyVatSpecification": {
141 "vatSubTotal": [
142 {
143 "taxableAmount": 50.0,
144 "vatAmount": 5.5,
145 "vatRate": 1.0,
146 "vatCategoryCode": "O"
147 }
148 ],
149 "taxCurrencyCode": "GBP",
150 "exchangeRate": 1.55
151 },
152 "taxReduction": {
153 "taxReductionDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
154 "taxReductionAmount": 0.01
155 }
156 }
David Persson 75.1 157 }
158 {{/code}}
159
160 ==== Example of a new credit invoice ====
161
162 {{code language="http" title="**Request**"}}
163 POST /ledger/invoice-service/v1/XXX/invoices HTTP/1.1
164 Host: -
165 Authorization: Bearer <Token>
166 Content-Type: application/json
167
168 {
Eric Runer 93.1 169 "customerNo": "2992682",
170 "invoiceNo": "000004",
171 "invoiceDate": "2021-05-17",
172 "externalInvoiceId": "900004",
173 "currency": "SEK",
174 "invoiceAddress": {
175 "addressee": "Annie Testsson",
176 "streetAddress": "Teststreet 1",
177 "zipCode": "50000",
178 "city": "Testcity",
179 "coAddress": "CO Bengtsson",
180 "countryCode": "SE"
181 },
182 "distribution": null,
183 "invoiceReason": {
184 "invoiceReasonCode": "CAS",
185 "invoiceReasonDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet"
186 },
187 "legalMonetaryTotal": {
188 "payableAmount": -88.0,
189 "vatInclusiveAmount": -88.01,
190 "vatExclusiveAmount": -88.01
191 },
192 "referenceInfo": {
193 "invoicePeriod": {
194 "startDate": "2021-04-07",
195 "endDate": "2021-04-25"
196 },
197 "deliveryInfo": {
198 "deliveryDate": "2021-04-27",
199 "deliveryAddress": {
David Persson 75.1 200 "addressee": "Name of recipient",
201 "streetAddress": "Teststreet 789",
202 "zipCode": "11111",
203 "city": "Testcity",
204 "coAddress": "C/O Andersson",
205 "countryCode": "SE"
Eric Runer 93.1 206 }
207 },
208 "purchaseOrderReference": "Lorem ipsum dolor sit amet",
209 "salesOrderReference": "Lorem ipsum dolor sit amet",
210 "buyerReference": "Lorem ipsum dolor sit amet",
211 "invoicedObjectIdentifier": "Lorem ipsum do",
212 "contractReference": "Lorem ipsum dolor sit amet",
213 "despatchReference": "Lorem ipsum dolor sit amet",
214 "receiptReference": "Lorem ipsum dolor sit amet",
215 "tenderReference": "Lorem ipsum dolor sit amet",
216 "projectReference": "Lorem ipsum dolor sit amet",
217 "debitInvoiceReferences": [
218 {
219 "debitInvoiceReference": "InvoiceNo xxxx"
220 }
221 ]
222 },
223 "InvoiceNote": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
224 "invoiceSpecification": {
225 "inclVat": true,
226 "roundingAmount": 0.01,
227 "invoiceLines": [
228 {
229 "itemDescription": "Description of item 1",
230 "amount": -88.01
231 }
232 ],
233 "invoiceVatSpecification": {
234 "vatSubTotal": [
David Persson 33.1 235 {
Eric Runer 93.1 236 "taxableAmount": -88.01,
237 "vatAmount": 0.0,
238 "vatRate": 1,
239 "vatCategoryCode": "Z"
David Persson 33.1 240 }
Eric Runer 93.1 241 ]
242 },
243 "taxCurrencyVatSpecification": {
244 "vatSubTotal": [
David Persson 25.1 245 {
Eric Runer 93.1 246 "taxableAmount": 50.0,
247 "vatAmount": 5.5,
248 "vatRate": 1.0,
249 "vatCategoryCode": "O"
David Persson 25.1 250 }
Eric Runer 93.1 251 ],
252 "taxCurrencyCode": "GBP",
253 "exchangeRate": 1.55
254 }
255 }
David Persson 5.1 256 }
257 {{/code}}
258
David Persson 57.1 259 {{code language="http" title="**Response**"}}
260 HTTP/1.1 201 Created
261 Content-Type: application/json
David Persson 5.1 262
David Persson 57.1 263 {
264 "invoice" : "..ledger/invoice/v1/XXX/invoices/NNN",
265 }
266 {{/code}}
David Persson 5.1 267
David Persson 58.1 268 ==== Get single "create-invoice" request ====
David Persson 57.1 269
David Persson 58.1 270 {{code language="http" title="**Request**"}}
271 GET /ledger/invoice-service/v1/XXX/invoices/NNN HTTP/1.1
272 Host: -
273 Authorization: Bearer <Token>
274 Content-Type: application/json
David Persson 57.1 275
David Persson 58.1 276 {{/code}}
277
278 {{code language="http" title="**Response**"}}
279 POST /ledger/invoice-service/v1/XXX/invoices HTTP/1.1
280 Host: -
281 Authorization: Bearer <Token>
282 Content-Type: application/json
283
284 {
David Persson 76.1 285 "customerNo" : "900",
286 "invoiceNo" : "0000001",
287 "invoiceDate": "2021-05-15",
288 "preferredDueDate": "2021-06-15",
289 "externalInvoiceId": "900001",
290 "currency": "SEK",
David Persson 58.1 291 "invoiceAddress": {
David Persson 76.1 292 "addressee": "Annie Testsson",
293 "streetAddress": "Teststreet 1",
294 "zipCode": "50000",
295 "city": "Testcity",
296 "coAddress": "CO Bengtsson",
David Persson 58.1 297 "countryCode": "SE"
298 },
David Persson 77.1 299 "distribution": null,
David Persson 66.1 300 "invoiceReason": {
David Persson 76.1 301 "invoiceReasonCode": "CAS",
302 "invoiceReasonDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet"
David Persson 66.1 303 },
David Persson 58.1 304 "legalMonetaryTotal": {
David Persson 76.1 305 "payableAmount": 88.00,
306 "vatInclusiveAmount": 98.01,
307 "vatExclusiveAmount": 98.01
David Persson 58.1 308 },
309 "referenceInfo": {
David Persson 76.1 310 "invoicePeriod": {
311 "startDate": "2021-04-07",
312 "endDate": "2021-04-25"
David Persson 58.1 313 },
David Persson 76.1 314 "deliveryInfo": {
315 "deliveryDate": "2021-04-27",
316 "deliveryAddress": {
317 "addressee": "Namn på mottagre",
318 "streetAddress": "Testgatan 789",
319 "zipCode": "11111",
320 "city": "Sthlm",
321 "coAddress": "C/O Andersson",
322 "countryCode": "SE"
323 }
324 },
325 "purchaseOrderReference": "Lorem ipsum dolor sit amet",
326 "salesOrderReference": "Lorem ipsum dolor sit amet",
327 "buyerReference": "Lorem ipsum dolor sit amet",
328 "invoicedObjectIdentifier": "Lorem ipsum do",
329 "contractReference": "Lorem ipsum dolor sit amet",
330 "despatchReference": "Lorem ipsum dolor sit amet",
331 "receiptReference": "Lorem ipsum dolor sit amet",
332 "tenderReference": "Lorem ipsum dolor sit amet",
333 "projectReference": "Lorem ipsum dolor sit amet"
334 },
335 "InvoiceNote": "InvoiceNote-Text e Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, ",
David Persson 58.1 336 "invoiceSpecification": {
David Persson 76.1 337 "inclVat": true,
338 "roundingAmount": -0.01,
David Persson 58.1 339 "invoiceLines": [
340 {
David Persson 76.1 341 "itemDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
342 "amount": 98.00,
David Persson 58.1 343 "datePeriod": {
David Persson 76.1 344 "StartDate": "2021-04-21",
345 "EndDate": "2021-04-25"
David Persson 58.1 346 },
David Persson 76.1 347 "gTIN": "156789123",
348 "itemObjectIdentifier": "itemObjectIdentifier",
349 "quantity": 8,
350 "unit": "ANN",
351 "unitPrice": 10.00,
352 "vatCategoryCode": "AE",
353 "vatRate": 10
354 },
355 {
356 "itemDescription": "Lorem ipsum dolor sit amet",
357 "amount": 0.01
David Persson 58.1 358 }
359 ],
360 "invoiceVatSpecification": {
361 "vatSubTotal": [
362 {
David Persson 76.1 363 "taxableAmount": 98.01,
364 "vatAmount": 0.00,
365 "vatRate": 1,
366 "vatCategoryCode": "Z"
David Persson 58.1 367 }
368 ]
369 },
370 "taxCurrencyVatSpecification": {
371 "vatSubTotal": [
372 {
David Persson 76.1 373 "taxableAmount": 50.00,
374 "vatAmount": 5.50,
375 "vatRate": 1.00,
376 "vatCategoryCode": "O"
David Persson 58.1 377 }
378 ],
David Persson 76.1 379 "taxCurrencyCode": "GBP",
380 "exchangeRate": 1.55
David Persson 58.1 381 },
David Persson 76.1 382 "taxReduction": {
383 "taxReductionDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
384 "taxReductionAmount": 10
David Persson 69.1 385 }
David Persson 76.1 386
David Persson 58.1 387 }
388 }
389 {{/code}}
390
Karl Holmbom 101.1 391 ==== ====
David Persson 58.1 392
David Persson 5.1 393 (% id="HAccountresourceproperties" %)
David Persson 75.1 394 ==== Invoice resource properties ====
David Persson 5.1 395
David Persson 80.2 396 (% class="box infomessage" %)
397 (((
David Persson 79.3 398 For basic string properties, all characters included in "Basic Latin" and "Latin-1 Supplement" are generally supported unless otherwise stated in below table
David Persson 80.2 399 )))
David Persson 79.2 400
David Persson 29.1 401 (% class="table-bordered table-striped" %)
David Persson 54.1 402 |=(% style="width: 561.984px;" %)Property|=(% style="width: 1px;" %)Data type|=(% style="width: 213px;" %)Format|=(% style="width: 88px;" %)Required|=(% style="width: 792px;" %)Description
David Persson 84.2 403 |(% style="width:561.984px" %)customerNo|(% style="width:1px" %)string|(% style="width:213px" %)MinLength: 1
404 MaxLength: 15*
405 numeric, 1-9 |(% style="width:88px" %)Yes|(% style="width:792px" %)The unique identifier of the customer
406 MaxLength may differ depending on configuration
407 KID (Norway)
David Persson 8.2 408 |(% style="width:561.984px" %)(((
David Persson 7.1 409 invoiceNo
David Persson 80.1 410 )))|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 15
411 Regex pattern:(((
David Persson 7.1 412 [A-Za-z0-9\-]+
David Persson 54.1 413 )))|(% style="width:88px" %)Yes|(% style="width:792px" %)Your unique identifier/invoice number of the invoice
David Persson 70.3 414 |(% style="width:561.984px" %)invoiceDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 54.1 415 |(% style="width:561.984px" %)**invoiceAddress**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)(((
David Persson 34.1 416 Optional invoice address. Only used if different from customer name and legal address
David Persson 8.2 417 )))
David Persson 54.1 418 |(% style="width:561.984px" %) addressee|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)Yes|(% style="width:792px" %)Full name of addressee
Gunnar Bering 93.2 419 |(% style="width:561.984px" %) streetAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)Street address
David Persson 67.1 420 |(% style="width:561.984px" %) zipCode|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 9|(% style="width:88px" %)Yes|(% style="width:792px" %)Zipcode conforming to country standard
David Persson 94.1 421 |(% style="width:561.984px" %) city|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 27|(% style="width:88px" %)Yes|(% style="width:792px" %)City
Gunnar Bering 93.2 422 |(% style="width:561.984px" %) coAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)Care of address
David Persson 54.1 423 |(% style="width:561.984px" %) countryCode|(% style="width:1px" %)string|(% style="width:213px" %)ISO 3166-1 alpha-2|(% style="width:88px" %)Yes|(% style="width:792px" %)Country code according to ISO 3166
424 |(% style="width:561.984px" %)preferredDueDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)No|(% style="width:792px" %)(((
David Persson 70.2 425 Used if a specific duedate is preferred. Number of days between distributiondate, wich it set by PayEx based on invoicedate and processingdate, and preferred due date must exceed minimum payment terms for the specific country. Else minimum paymentterms for the country will be used. Number of days between distributiondate, which is set by PayEx based on invoicedate and processingdate, and preferred due date, can not exceed maximum paymentterms (default 60 days), if true an ERROR is created and the customer and its invoices will be rejected.
David Persson 7.1 426 )))
David Persson 79.4 427 |(% style="width:561.984px" %)externalInvoiceId|(% style="width:1px" %)string|(% style="width:213px" %)MaxLength: 50
428 Regex pattern:
429 ^[a-zA-Z0-9äåöÄÅÖ/_ -.]*$|(% style="width:88px" %)No|(% style="width:792px" %)Additional external unique invoice identfier in accountsreceivable
David Persson 54.1 430 |(% style="width:561.984px" %)distribution|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)(((
David Persson 39.1 431 * **Postal**
432 * **Email**
David Persson 72.7 433 * **EInvoiceB2B **//(some optional fields will be required if this is set*)//
Karl Holmbom 94.2 434 * **ArchiveOnly **//(available 2023-04-19)//
Fredrik Nilsson 90.1 435
436 If no distribution is set, [[default distribution priority >>doc:Main.Invoicing.invoice-service.invoice-service-apis.Invoice layout.WebHome||queryString="#HStandarddistributionorderofpriority"]]order will apply.
David Persson 39.1 437 )))
David Persson 54.1 438 |(% style="width:561.984px" %)currency|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)Valid currency supported in Your accountsreceivable
David Persson 39.1 439 |(% style="width:561.984px" %)(((
David Persson 65.1 440 __**invoiceReason**__
441 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)
442 |(% style="width:561.984px" %) invoiceReasonCode|(% style="width:1px" %)string|(% style="width:213px" %)[[UNCL7161>>https://docs.peppol.eu/poacc/billing/3.0/codelist/UNCL7161/]]|(% style="width:88px" %)No|(% style="width:792px" %)Invoice reason code according to format UNCL7161
443 |(% style="width:561.984px" %) invoiceReasonDescription|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 200|(% style="width:88px" %)Yes|(% style="width:792px" %)Description of the reason for the invoice
444 |(% style="width:561.984px" %)(((
David Persson 48.1 445 ==== __**legalMonetaryTotal**__ ====
David Persson 54.1 446 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
David Persson 48.1 447 Contains total amount and currency of the invoice. Positive amount is used for debit invoice. Negative amount is used for credit invoice
448 )))
David Persson 54.1 449 |(% style="width:561.984px" %) PayableAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
David Persson 52.1 450 Max size: 100000000
David Persson 71.2 451 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount to by payed. LegalMonetary.VatInclusiveAmount + Invoicespecification.Roundingamount - InvoiceSpecification.TaxReductionAmount
David Persson 54.1 452 |(% style="width:561.984px" %) VatInclusiveAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
David Persson 52.1 453 Max size: 100000000
David Persson 70.5 454 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount inclusive of Vat. Equals sum of InvoiceSpecification.InvoiceVatSpecification.VatSubTotal.TaxableAmount + VatAmount
David Persson 54.1 455 |(% style="width:561.984px" %) VatExclusiveAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
David Persson 52.1 456 Max size: 100000000
David Persson 70.5 457 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount exclusive of Vat. Equals sum of InvoiceSpecification.InvoiceVatSpecification.VatSubTotal.TaxableAmount
David Persson 48.1 458 |(% style="width:561.984px" %)(((
David Persson 39.1 459 ==== __**referenceInfo**__ ====
David Persson 54.1 460 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Containing invoice reference information
David Persson 57.1 461 |(% style="width:561.984px" %)**__invoicePeriod__**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Optional invoiceperiod. Used in EDI
David Persson 54.1 462 |(% style="width:561.984px" %) startDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)Yes|(% style="width:792px" %)
463 |(% style="width:561.984px" %) endDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 57.1 464 |(% style="width:561.984px" %)**__deliveryInfo__**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Optional deliveryinformation of product/service invoiced. Also used in EDI
David Persson 54.1 465 |(% style="width:561.984px" %) deliveryDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)No|(% style="width:792px" %)
David Persson 57.1 466 |(% style="width:561.984px" %)**__deliveryAddress__**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 54.1 467 |(% style="width:561.984px" %) addressee|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)Yes|(% style="width:792px" %)
Gunnar Bering 93.2 468 |(% style="width:561.984px" %) streetAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)
David Persson 67.1 469 |(% style="width:561.984px" %) zipCode|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 9|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 94.1 470 |(% style="width:561.984px" %) city|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 27|(% style="width:88px" %)Yes|(% style="width:792px" %)
Gunnar Bering 93.2 471 |(% style="width:561.984px" %) coAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)
David Persson 54.1 472 |(% style="width:561.984px" %) countryCode|(% style="width:1px" %)string|(% style="width:213px" %)ISO 3166-1 alpha-2|(% style="width:88px" %)Yes|(% style="width:792px" %)
473 |(% style="width:561.984px" %) purchaseOrderReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional unique purchase order reference issued by the Buyer. Used in EDI
474 |(% style="width:561.984px" %) salesOrderReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional sales order reference issued by Seller. Used in EDI
475 |(% style="width:561.984px" %) buyerReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference of who ordered the products/services. Example being the name of the person ordering, employee number or a code identifying this person or department/group. Your ref is often used for internal routing at recipient, and hence it is important to fill this element with the correct values according to the need of the recipient. Used in EDI
476 |(% style="width:561.984px" %) invoicedObjectIdentifier|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional identifier for an object on which the invoice is based, given by the Seller. Examples may be a subscription number, telephone number, meter point, vehicle, person etc., as applicable. Used in EDI
477 |(% style="width:561.984px" %) contractReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference to a purchase contract. Used in EDI
478 |(% style="width:561.984px" %) despatchReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference to a despatch advice. Used in EDI
479 |(% style="width:561.984px" %) receiptReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference to a receipt advice. Used in EDI
480 |(% style="width:561.984px" %) tenderReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference to the tenderer or lot, in most cases the Procurement Procedure Identifier. Used in EDI
481 |(% style="width:561.984px" %) projectReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional reference to a project. Used in EDI
482 |(% style="width:561.984px" %) debitInvoiceReferences|(% style="width:1px" %)list|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)If creditinvoice, optional reference to debit invoice. Used in EDI
483 |(% style="width:561.984px" %) debitInvoiceReference|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)Yes|(% style="width:792px" %)Reference to debit invoice
David Persson 72.2 484 |(% style="width:561.984px" %)invoiceNote|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 250|(% style="width:88px" %)No|(% style="width:792px" %)A textual note that gives unstructured information that is relevant to the Invoice as a whole
David Persson 39.1 485 |(% style="width:561.984px" %)(((
486 ==== __**invoiceSpecification**__ ====
David Persson 54.1 487 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
David Persson 8.2 488 Contains the specification of the invoice
489 )))
David Persson 54.1 490 |(% style="width:561.984px" %) inclVat|(% style="width:1px" %)bool|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)If True, invoiceLine.amount must include Vat. If False, invoiceLine.amount must exclude Vat. EDI-distribution requires an excl vat InvoiceSpecification
David Persson 71.3 491 | roundingAmount|decimal|Fraction digits: 2
492 Max size: 0.99
David Persson 72.6 493 Min size: -0.99|No|Roundingamount +- 0.99
494 not affected by VAT
David Persson 8.2 495 |(% style="width:561.984px" %)(((
David Persson 73.2 496 **__invoiceLines__**
David Persson 54.1 497 )))|(% style="width:1px" %)list|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)
498 |(% style="width:561.984px" %) itemDescription|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 250|(% style="width:88px" %)Yes|(% style="width:792px" %)Mandatory description of the invoiced item/service
David Persson 72.3 499 |(% style="width:561.984px" %) amount|(% style="width:1px" %)decimal|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)Mandatory amount rounded to two decimals. inclusive or exclusive of vat dependends of setting of the boolean attribute Invoicespecification.InclVat
David Persson 73.2 500 //Sum of the amounts of all invoiceLines must equal to legalMonetaryTotal.VatInclusiveAmount or VatExclusiveAmount, depending on Invoicespecification.InclVat true/false.//
David Persson 76.1 501 |(% style="width:561.984px" %)__**datePeriod**__|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Optional date/period
David Persson 54.1 502 |(% style="width:561.984px" %) startDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)Yes|(% style="width:792px" %)
503 |(% style="width:561.984px" %) endDate|(% style="width:1px" %)date|(% style="width:213px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:88px" %)No|(% style="width:792px" %)
504 |(% style="width:561.984px" %) gtin|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 15|(% style="width:88px" %)No|(% style="width:792px" %)Optional global trade item identifier (GS1 GTIN)
Jens Kral 87.1 505 |(% style="width:561.984px" %) itemObjectIdentifier|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 50|(% style="width:88px" %)No|(% style="width:792px" %)Optional identifier for an object on which the invoiceitem is based, given by the Seller. Examples may be a subscription number, telephone number, meter point, vehicle, person etc., as applicable. Used in EDI
David Persson 54.1 506 |(% style="width:561.984px" %) quantity|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 5
David Persson 52.1 507 Max size: 100000000
David Persson 72.5 508 Min size: -100000000|(% style="width:88px" %)No*|(% style="width:792px" %)//*This field is required if distribution is set to EInvoiceB2B//
509 Optional quantity with up to 5 decimals
510 |(% style="width:561.984px" %) unit|(% style="width:1px" %)string|(% style="width:213px" %)UNECERec20 |(% style="width:88px" %)No*|(% style="width:792px" %)(((
511 //*This field is required if distribution is set to EInvoiceB2B//
512 Optional unit of quantity according to UNECERec20 code list:
513
514 (((
Fredrik Nilsson 98.1 515 * **C62 **//- Used for unit-less count (pcs)//
David Persson 36.1 516 * **KGM **//- Kilogram//
Fredrik Nilsson 88.1 517 * **GRM **//- Gram//
David Persson 36.1 518 * **AD **//- Byte//
Karl Holmbom 98.2 519 * **2P **//- Kilobyte//
David Persson 36.1 520 * **4L **//- Megabyte//
521 * **E34 **//- Gigabyte//
522 * **E35 **//- Terabyte//
523 * **SEC **//- Seconds//
524 * **MIN **//- Minutes//
525 * **DAY**// - Day//
526 * **WEE**// - Week//
527 * **MON **//- Month//
528 * **ANN **//- Year//
Karl Holmbom 101.1 529 * **DZN** – Dozen, A unit of count defining the number of units in multiples of 12.
530 * **KMT** – Kilometer
531 * **MTR** – Meter
532 * **DMT** – Decimeter
533 * **CMT** – Centimeter
534 * **MMT** – Millimeter
535 * **MTK** – Square meter
536 * **MTQ** – Cubic meter
537 * **LTR** – Liter
538 * **DLT** – Deciliter
539 * **CLT** – Centiliter
540 * **MLT** – Milliliter
541 * **TNE** – Tonne (metric ton)
542 * **HUR** – Hour
543 * **KWH** – Kilowatt hour
544 * **E48** – Service unit, A unit of count defining the number of service units (service unit: defined period / property / facility / utility of supply).
545 * **E51** – Job, A unit of count defining the number of jobs.
546 * **E53** – Test, A unit of count defining the number of tests.
547 * **IE** – Person, A unit of count defining the number of persons.
548 * **XPX** – Pallet
549 * **XPK** – Package
550 * **LS** – Lump sum
David Persson 36.1 551 )))
David Persson 72.5 552 )))
David Persson 54.1 553 |(% style="width:561.984px" %) unitPrice|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 5
David Persson 52.1 554 Max size: 100000000
David Persson 72.5 555 Min size: 0|(% style="width:88px" %)No*|(% style="width:792px" %)//*This field is required if distribution is set to EInvoiceB2B//
556 Optional unitprice with up to 5 decimals. Inclusive or exclusive of vat dependent of setting of the boolean attribute Invoicespecification.InclVat
David Persson 54.1 557 |(% style="width:561.984px" %) vatCategoryCode|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Optional VatCategoryCode according to UN/CEFACT code list 5305, D.16B(((
David Persson 34.1 558 * **AE **-// VAT Reverse Charge: Code specifying that the standard VAT rate is levied from the invoicee//
559 * **E **- //Exempt from tax: Code specifying that taxes are not applicable//
560 * **S **- //Standard rate: Code specifying the standard rate//
561 * **Z** - //Zero rated goods: Code specifying that the goods are at a zero rate//
562 * **G** - //Free export item, tax not charged: Code specifying that the item is free export and taxes are not charged//
563 * **O** - //Services outside scope of tax: Code specifying that taxes are not applicable to the services//
564 * **K** - //VAT exempt for EEA intra-community supply of goods and services. A tax category code indicating the item is VAT exempt due to an intra-community supply in the European Economic Area//
565 )))
David Persson 54.1 566 |(% style="width:561.984px" %) vatRate|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
David Persson 52.1 567 Max size: 100.00
David Persson 54.1 568 Min size: 0.00|(% style="width:88px" %)No|(% style="width:792px" %)Optional valid VatRate
David Persson 8.2 569 |(% style="width:561.984px" %)(((
David Persson 73.2 570 **__invoiceVatSpecifications__**
David Persson 62.4 571 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)Is specified once per distinct combination of VatCategoryCode and VatRate. Each combination must match sum of corresponding InvoiceLines
David Persson 69.3 572 |(% style="width:561.984px" %) vatSubTotal|(% style="width:1px" %)list|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)VatSubTotal is specified once per combination of VatCategoryCode and VatRate
David Persson 62.10 573 |(% style="width:561.984px" %) taxableAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
574 Min size: -100000000
575 Max size: 100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)
576 |(% style="width:561.984px" %) vatAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
577 Min size: -100000000
578 Max size: 100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 54.1 579 |(% style="width:561.984px" %) vatRate|(% style="width:1px" %)decimal|(% style="width:213px" %)percentage
David Persson 9.1 580 min: 0.00
David Persson 54.1 581 max: 100.00|(% style="width:88px" %)Yes|(% style="width:792px" %)vatRate in percentage
582 |(% style="width:561.984px" %) vatCategoryCode|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
David Persson 9.1 583 Valid values:
584
David Persson 8.2 585 * **AE **-// VAT Reverse Charge: Code specifying that the standard VAT rate is levied from the invoicee//
586 * **E **- //Exempt from tax: Code specifying that taxes are not applicable//
587 * **S **- //Standard rate: Code specifying the standard rate//
588 * **Z** - //Zero rated goods: Code specifying that the goods are at a zero rate//
589 * **G** - //Free export item, tax not charged: Code specifying that the item is free export and taxes are not charged//
590 * **O** - //Services outside scope of tax: Code specifying that taxes are not applicable to the services//
591 * **K** - //VAT exempt for EEA intra-community supply of goods and services. A tax category code indicating the item is VAT exempt due to an intra-community supply in the European Economic Area//
592 )))
David Persson 62.4 593 |(% style="width:561.984px" %)(((
David Persson 73.2 594 **__taxCurrencyVatSpecification__**
David Persson 64.1 595 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Used if seller tax currency is other than invoice currency
David Persson 76.1 596 |(% style="width:561.984px" %)**vatSubTotal**|(% style="width:1px" %)list|(% style="width:213px" %)required 1-10 items|(% style="width:88px" %)Yes|(% style="width:792px" %)VatSubTotal is specified once per combination of VatCategoryCode and VatRate
David Persson 70.1 597 |(% style="width:561.984px" %) taxableAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)amount|(% style="width:88px" %)Yes|(% style="width:792px" %)
598 |(% style="width:561.984px" %) vatAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)amount|(% style="width:88px" %)Yes|(% style="width:792px" %)
599 |(% style="width:561.984px" %) vatRate|(% style="width:1px" %)decimal|(% style="width:213px" %)percentage
David Persson 62.4 600 min: 0.00
601 max: 100.00|(% style="width:88px" %)Yes|(% style="width:792px" %)vatRate in percentage
David Persson 70.1 602 |(% style="width:561.984px" %) vatCategoryCode|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
David Persson 62.4 603 Valid values:
604
605 * **AE **-// VAT Reverse Charge: Code specifying that the standard VAT rate is levied from the invoicee//
606 * **E **- //Exempt from tax: Code specifying that taxes are not applicable//
607 * **S **- //Standard rate: Code specifying the standard rate//
608 * **Z** - //Zero rated goods: Code specifying that the goods are at a zero rate//
609 * **G** - //Free export item, tax not charged: Code specifying that the item is free export and taxes are not charged//
610 * **O** - //Services outside scope of tax: Code specifying that taxes are not applicable to the services//
611 * **K** - //VAT exempt for EEA intra-community supply of goods and services. A tax category code indicating the item is VAT exempt due to an intra-community supply in the European Economic Area//
612 )))
David Persson 62.6 613 |(% style="width:561.984px" %) taxCurrencyCode|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)The tax currency code of the seller
David Persson 62.8 614 |(% style="width:561.984px" %) exchangeRate|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 5
615 Min size: 0.00001|(% style="width:88px" %)Yes|(% style="width:792px" %)ExchangeRate used to calculate vat in seller tax currency
David Persson 62.4 616 |(% style="width:561.984px" %)**__taxReduction__**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Taxreduction used for Reversed Tax and ROT/RUT
David Persson 72.2 617 |(% style="width:561.984px" %) taxReductionDescription|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 250|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 62.6 618 |(% style="width:561.984px" %) taxReductionAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
David Persson 62.5 619 Min size: 0,01
620 Max size: 100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)
David Persson 5.1 621
622 (% id="HBills" %)
Karl Holmbom 101.1 623 == ==
David Persson 5.1 624
625 (% id="H-1" %)
David Persson 31.1 626 ==== Problems ====
David Persson 5.1 627
628 All errors from the api are returned in the form of "problems" (response body), except for the http status code itself.
629 The problem object contain more detailed info on what the error is. The "type" property can be used to programmatically interpret the error as it contains a code definition of the problem.
630 Other properties can be useful for logging and subsequent troubleshooting. Some problems are extended with additional parameters so it may be a good idea to log response body as raw data to include these.
631
632 Problems of type validation does contain an additional list ("Problems") that describes exactly which parameter that failed the validation
633
634 === Example ===
635
636 {{code language="http" title="**Response**"}}
637 HTTP/1.1 400 Error
638 Content-Type: application/problem+json
639
640 {
David Persson 91.1 641 "Type" : "ledger/invoice-service/v1/problems/validation",
David Persson 5.1 642 "Title" : "A validation error occurred",
643 "Status" : 400,
644 "Instance" : "215d4206-ca35-4f43-85ad-169c8f6d4ec1",
645 "Detail" : "A validation error occurred. Please fix the problems mentioned in the 'problems' property below.",
646 "Problems" : [
647 {
648 "amount" : "Expected value between [0,01]-[79228162514264337593543950335] actual [0]"
649 }
650 ]
651 }
652 {{/code}}
653
654 === Problem types ===
655
656 (% class="box infomessage" %)
657 (((
David Persson 50.1 658 Note, each problem typecode is preceded by "ledger.invoice-service." in this API, e.g. the error "validation" in the table below will appear as typecode "ledger.invoice-service.validation".
David Persson 5.1 659 )))
660
661 (% class="table-bordered table-striped" %)
662 |=(% style="width: 537px;" %)Problem type (code)|=(% style="width: 172px;" %)Httpstatus|=(% style="width: 796px;" %)Description
663 |(% style="width:537px" %)validation|(% style="width:172px" %)400|(% style="width:796px" %)occurs if any of the inputvalidation fails, it is described in the problem which parameter that failed the validation
David Persson 50.1 664 |(% style="width:537px" %)invoice-not-found|(% style="width:172px" %)404|(% style="width:796px" %)