Wiki source code of 3. Invoice-service

Last modified by Karl Holmbom on 2024/10/07 13:26
Show last authors
1 (% class="jumbotron" %)
2 (((
3 (% class="container" %)
4 (((
5 Integrate to **PayEx Invoice service API **
6 )))
7 )))
8
9 == Introduction ==
10
11 This API is used to create new invoices on existing customers
12
13 [[image:1615196225210-926.png||height="100" width="390"]]
14
15
16 Each resource in the API corresponds to its own route. All routes are structured according to a specific standard, explained below
17
18 The below route is an example of a route towards resource1Id
19 //lf-api.payex.com/ledger/**{Subdomain}**/v1/**{LedgerNumber}**/resource1/**{resource1Id}**//
20
21 (% class="table-bordered table-striped" %)
22 |=(% style="width: 604px;" %)Route segment|=(% style="width: 2790px;" %)Description
23 |(% style="width:604px" %)Subdomain|(% style="width:2790px" %)In this part of the API it will be **invoice-service**
24 |(% style="width:604px" %)LedgerNumber|(% style="width:2790px" %)The ledger identifier/number at PayEx
25 |(% style="width:604px" %)InvoiceNo|(% style="width:2790px" %)Identifier of resource invoice
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
35 == ==
36
37 == Invoices ==
38
39 This resource is used to create new invoices, both debit invoices and credit invoices
40
41 (% class="box infomessage" %)
42 (((
43 Batches of multiple invoices should be processed sequentially towards the API. Each API call is intended for the creation of a single invoice
44 )))
45
46 ==== Example of a new debit invoice ====
47
48 {{code language="http" title="**Request**"}}
49 POST /ledger/invoice-service/v1/XXX/invoices HTTP/1.1
50 Host: -
51 Authorization: Bearer <Token>
52 Content-Type: application/json
53
54 {
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": {
87 "addressee": "Namn på mottagre",
88 "streetAddress": "Testgatan 789",
89 "zipCode": "11111",
90 "city": "Sthlm",
91 "coAddress": "C/O Andersson",
92 "countryCode": "SE"
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"
116 },
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": [
132 {
133 "taxableAmount": 98.01,
134 "vatAmount": 0.0,
135 "vatRate": 1,
136 "vatCategoryCode": "Z"
137 }
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 }
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 {
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": {
200 "addressee": "Name of recipient",
201 "streetAddress": "Teststreet 789",
202 "zipCode": "11111",
203 "city": "Testcity",
204 "coAddress": "C/O Andersson",
205 "countryCode": "SE"
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": [
235 {
236 "taxableAmount": -88.01,
237 "vatAmount": 0.0,
238 "vatRate": 1,
239 "vatCategoryCode": "Z"
240 }
241 ]
242 },
243 "taxCurrencyVatSpecification": {
244 "vatSubTotal": [
245 {
246 "taxableAmount": 50.0,
247 "vatAmount": 5.5,
248 "vatRate": 1.0,
249 "vatCategoryCode": "O"
250 }
251 ],
252 "taxCurrencyCode": "GBP",
253 "exchangeRate": 1.55
254 }
255 }
256 }
257 {{/code}}
258
259 {{code language="http" title="**Response**"}}
260 HTTP/1.1 201 Created
261 Content-Type: application/json
262
263 {
264 "invoice" : "..ledger/invoice/v1/XXX/invoices/NNN",
265 }
266 {{/code}}
267
268 ==== Get single "create-invoice" request ====
269
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
275
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 {
285 "customerNo" : "900",
286 "invoiceNo" : "0000001",
287 "invoiceDate": "2021-05-15",
288 "preferredDueDate": "2021-06-15",
289 "externalInvoiceId": "900001",
290 "currency": "SEK",
291 "invoiceAddress": {
292 "addressee": "Annie Testsson",
293 "streetAddress": "Teststreet 1",
294 "zipCode": "50000",
295 "city": "Testcity",
296 "coAddress": "CO Bengtsson",
297 "countryCode": "SE"
298 },
299 "distribution": null,
300 "invoiceReason": {
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"
303 },
304 "legalMonetaryTotal": {
305 "payableAmount": 88.00,
306 "vatInclusiveAmount": 98.01,
307 "vatExclusiveAmount": 98.01
308 },
309 "referenceInfo": {
310 "invoicePeriod": {
311 "startDate": "2021-04-07",
312 "endDate": "2021-04-25"
313 },
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, ",
336 "invoiceSpecification": {
337 "inclVat": true,
338 "roundingAmount": -0.01,
339 "invoiceLines": [
340 {
341 "itemDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
342 "amount": 98.00,
343 "datePeriod": {
344 "StartDate": "2021-04-21",
345 "EndDate": "2021-04-25"
346 },
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
358 }
359 ],
360 "invoiceVatSpecification": {
361 "vatSubTotal": [
362 {
363 "taxableAmount": 98.01,
364 "vatAmount": 0.00,
365 "vatRate": 1,
366 "vatCategoryCode": "Z"
367 }
368 ]
369 },
370 "taxCurrencyVatSpecification": {
371 "vatSubTotal": [
372 {
373 "taxableAmount": 50.00,
374 "vatAmount": 5.50,
375 "vatRate": 1.00,
376 "vatCategoryCode": "O"
377 }
378 ],
379 "taxCurrencyCode": "GBP",
380 "exchangeRate": 1.55
381 },
382 "taxReduction": {
383 "taxReductionDescription": "Lorem ipsum dolor sit amet, Lorem ipsum dolor sit amet",
384 "taxReductionAmount": 10
385 }
386
387 }
388 }
389 {{/code}}
390
391 ==== ====
392
393 (% id="HAccountresourceproperties" %)
394 ==== Invoice resource properties ====
395
396 (% class="box infomessage" %)
397 (((
398 For basic string properties, all characters included in "Basic Latin" and "Latin-1 Supplement" are generally supported unless otherwise stated in below table
399 )))
400
401 (% class="table-bordered table-striped" %)
402 |=(% style="width: 561.984px;" %)Property|=(% style="width: 1px;" %)Data type|=(% style="width: 213px;" %)Format|=(% style="width: 88px;" %)Required|=(% style="width: 792px;" %)Description
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)
408 |(% style="width:561.984px" %)(((
409 invoiceNo
410 )))|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 15
411 Regex pattern:(((
412 [A-Za-z0-9\-]+
413 )))|(% style="width:88px" %)Yes|(% style="width:792px" %)Your unique identifier/invoice number of the invoice
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" %)
415 |(% style="width:561.984px" %)**invoiceAddress**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)(((
416 Optional invoice address. Only used if different from customer name and legal address
417 )))
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
419 |(% style="width:561.984px" %) streetAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)Street address
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
421 |(% style="width:561.984px" %) city|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 27|(% style="width:88px" %)Yes|(% style="width:792px" %)City
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
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" %)(((
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.
426 )))
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
430 |(% style="width:561.984px" %)distribution|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)(((
431 * **Postal**
432 * **Email**
433 * **EInvoiceB2B **//(some optional fields will be required if this is set*)//
434 * **ArchiveOnly **//(available 2023-04-19)//
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.
437 )))
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
439 |(% style="width:561.984px" %)(((
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" %)(((
445 ==== __**legalMonetaryTotal**__ ====
446 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
447 Contains total amount and currency of the invoice. Positive amount is used for debit invoice. Negative amount is used for credit invoice
448 )))
449 |(% style="width:561.984px" %) PayableAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
450 Max size: 100000000
451 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount to by payed. LegalMonetary.VatInclusiveAmount + Invoicespecification.Roundingamount - InvoiceSpecification.TaxReductionAmount
452 |(% style="width:561.984px" %) VatInclusiveAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
453 Max size: 100000000
454 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount inclusive of Vat. Equals sum of InvoiceSpecification.InvoiceVatSpecification.VatSubTotal.TaxableAmount + VatAmount
455 |(% style="width:561.984px" %) VatExclusiveAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
456 Max size: 100000000
457 Min size: -100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)Total amount exclusive of Vat. Equals sum of InvoiceSpecification.InvoiceVatSpecification.VatSubTotal.TaxableAmount
458 |(% style="width:561.984px" %)(((
459 ==== __**referenceInfo**__ ====
460 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Containing invoice reference information
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
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" %)
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
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" %)
466 |(% style="width:561.984px" %)**__deliveryAddress__**|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)
467 |(% style="width:561.984px" %) addressee|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)Yes|(% style="width:792px" %)
468 |(% style="width:561.984px" %) streetAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)
469 |(% style="width:561.984px" %) zipCode|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 9|(% style="width:88px" %)Yes|(% style="width:792px" %)
470 |(% style="width:561.984px" %) city|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 27|(% style="width:88px" %)Yes|(% style="width:792px" %)
471 |(% style="width:561.984px" %) coAddress|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 72|(% style="width:88px" %)No|(% style="width:792px" %)
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
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
485 |(% style="width:561.984px" %)(((
486 ==== __**invoiceSpecification**__ ====
487 )))|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
488 Contains the specification of the invoice
489 )))
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
491 | roundingAmount|decimal|Fraction digits: 2
492 Max size: 0.99
493 Min size: -0.99|No|Roundingamount +- 0.99
494 not affected by VAT
495 |(% style="width:561.984px" %)(((
496 **__invoiceLines__**
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
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
500 //Sum of the amounts of all invoiceLines must equal to legalMonetaryTotal.VatInclusiveAmount or VatExclusiveAmount, depending on Invoicespecification.InclVat true/false.//
501 |(% style="width:561.984px" %)__**datePeriod**__|(% style="width:1px" %)object|(% style="width:213px" %) |(% style="width:88px" %)No|(% style="width:792px" %)Optional date/period
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)
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
506 |(% style="width:561.984px" %) quantity|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 5
507 Max size: 100000000
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 (((
515 * **C62 **//- Used for unit-less count (pcs)//
516 * **KGM **//- Kilogram//
517 * **GRM **//- Gram//
518 * **AD **//- Byte//
519 * **2P **//- Kilobyte//
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//
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
551 )))
552 )))
553 |(% style="width:561.984px" %) unitPrice|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 5
554 Max size: 100000000
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
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(((
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 )))
566 |(% style="width:561.984px" %) vatRate|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
567 Max size: 100.00
568 Min size: 0.00|(% style="width:88px" %)No|(% style="width:792px" %)Optional valid VatRate
569 |(% style="width:561.984px" %)(((
570 **__invoiceVatSpecifications__**
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
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
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" %)
579 |(% style="width:561.984px" %) vatRate|(% style="width:1px" %)decimal|(% style="width:213px" %)percentage
580 min: 0.00
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" %)(((
583 Valid values:
584
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 )))
593 |(% style="width:561.984px" %)(((
594 **__taxCurrencyVatSpecification__**
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
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
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
600 min: 0.00
601 max: 100.00|(% style="width:88px" %)Yes|(% style="width:792px" %)vatRate in percentage
602 |(% style="width:561.984px" %) vatCategoryCode|(% style="width:1px" %)string|(% style="width:213px" %) |(% style="width:88px" %)Yes|(% style="width:792px" %)(((
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 )))
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
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
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
617 |(% style="width:561.984px" %) taxReductionDescription|(% style="width:1px" %)string|(% style="width:213px" %)Maxlength: 250|(% style="width:88px" %)Yes|(% style="width:792px" %)
618 |(% style="width:561.984px" %) taxReductionAmount|(% style="width:1px" %)decimal|(% style="width:213px" %)Fraction digits: 2
619 Min size: 0,01
620 Max size: 100000000|(% style="width:88px" %)Yes|(% style="width:792px" %)
621
622 (% id="HBills" %)
623 == ==
624
625 (% id="H-1" %)
626 ==== Problems ====
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 {
641 "Type" : "ledger/invoice-service/v1/problems/validation",
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 (((
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".
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
664 |(% style="width:537px" %)invoice-not-found|(% style="width:172px" %)404|(% style="width:796px" %)