Wiki source code of 4. Invoice

Last modified by Anders Göthberg on 2024/10/02 10:02
Show last authors
1 (% class="jumbotron" %)
2 (((
3 (% class="container" %)
4 (((
5 Integrate to **PayEx Invoice API **
6 )))
7 )))
8
9 (% id="HRoutesegments" %)
10 == Introduction ==
11
12 (% class="lead" %)
13 This api is used to retrieve information related to the customer's invoices.
14
15 [[image:1670584338716-116.png||height="815" width="406"]]
16
17
18 PayEx supports HTTP headers for tracking that are used for troubleshooting purposes, implement according to [[specification>>https://developer.payex.com/xwiki/wiki/developer/view/Main/Invoicing/invoice-service/Technical%20reference/API/security/#HHTTPHeaders]]
19
20 Each resource in the API corresponds to its own route. All routes are structured according to a specific standard, explained below
21
22 The below route is an example of a route towards resource3Id, to operate on this resource you must also include the ids of its parentresources in the route.
23 //lf-api.payex.com/ledger/**{Subdomain}**/v1/**{LedgerNumber}**/resource1/**{resource1Id}**/resource2/**{resource2Id}**/resource3/**{resource3Id}**//
24
25 (% class="table-bordered table-striped" %)
26 |=(% style="width: 604px;" %)Route segment|=(% style="width: 2790px;" %)Description
27 |(% style="width:604px" %)Subdomain|(% style="width:2790px" %)In this part of the API it will be invoice
28 |(% style="width:604px" %)LedgerNumber|(% style="width:2790px" %)The ledger identifier/number at PayEx
29 |(% style="width:604px" %)resource1Id|(% style="width:2790px" %)Identifier of resource1
30 |(% style="width:604px" %)resource2Id|(% style="width:2790px" %)identifier of resource2, subresource to resource1
31 |(% style="width:604px" %)resource3Id|(% style="width:2790px" %)identifier of resource3, subresource to resource2
32
33 (% class="wikigeneratedid" %)
34 Routes that occurs in examples of this documentation will use the following identifiers
35
36 (% class="table-bordered table-striped" %)
37 |=(% style="width: 330px;" %)Resource|=(% style="width: 1517px;" %)Identifier
38 |(% style="width:330px" %)LedgerNumber|(% style="width:1517px" %)XXX
39 |(% style="width:330px" %)Invoices|(% style="width:1517px" %)NNN (invoiceNo)
40 |(% style="width:330px" %)Documents|(% style="width:1517px" %)YYY (type)
41
42 == Invoice ==
43
44 The **invoice **resource is located under **ledger/invoice/v1/ **api**. **This resource is used to get general information about existing invoices and its current state. Creation of new invoices is done through other resource.
45
46
47 ==== Get specific invoice ====
48
49 ==== ====
50
51 {{code language="http" title="**Request**"}}
52 GET /ledger/invoice/v1/XXX/invoices/NNN HTTP/1.1
53 Host: -
54 Authorization: Bearer <Token>
55 Content-Type: application/json
56 {{/code}}
57
58
59 {{code language="http" title="**Response**"}}
60 HTTP/1.1 200 OK
61 Content-Type: application/json
62
63 {
64 "@id" : "/ledger/invoice/v1/XXX/invoices/12345",
65 "created" : "2019-05-06T00:00:00",
66 "invoiceNo" : "12345",
67 "externalInvoiceId" : "987654321",
68 "status" : "pending|open|closed",
69 "claimLevel" : "Invoice|RestReminder|Reminder|SecondReminder|CollectionClaim|DebtCollection",
70 "currentDebt" : 463.42,
71 "originalAmount" : 354.10,
72 "currency" : "sek",
73 "invoiceDate" : "2018-10-01T00:00:00",
74 "dueDate" : "2018-10-01T00:00:00",
75 "seller" : {
76 "name" : "testshop",
77 "number" : "12345"
78 },
79 "debt" : {
80 "capital" : 354.10,
81 "remiderFee" : 20.00,
82 "collectionFee" : 80.00,
83 "penaltyInterest" : 8.00,
84 "calculatedPenaltyInterest" : 1.32
85 },
86 "penaltyInterestRate": 15.00,
87 "bankPayment": {
88 "bankAccountNo": "123",
89 "bankAccountType": "BGSE",
90 "bic": "123456",
91 "iban": "SE12345678945631",
92 "paymentReference": "54867165675646"
93 },
94 "customer" : "/ledger/customer/v1/customers/XYZABC",
95 "transactions" : "/ledger/invoice/v1/XXX/invoices/12345/transactions",
96 "activePaymentOrders": "/ledger/invoice/v1/XXX/invoices/NNN/active-payment-orders",
97 "journal" : "/ledger/invoice/v1/XXX/invoices/12345/journal",
98 "documents": "/ledger/invoice/v1/XXX/invoices/NNN/documents",
99 "operations": [
100 {
101 "rel": "generate-invoice-portal-link",
102 "method": "POST",
103 "href": "/ledger/invoice/v1/XXX/invoices/NNN/generate-invoice-portal-link"
104 },
105 {
106 "rel": "transfer-to-account",
107 "method": "POST",
108 "href": "/ledger/invoice/v1/XXX/invoices/NNN/transfer-to-account"
109 }
110 ],
111 }
112 {{/code}}
113
114 ==== Get specific customers invoices ====
115
116 Use the querystring parameter "customerNo" to list invoices for a specific customer.
117
118
119 {{code language="http" title="**Request**"}}
120 GET /ledger/invoice/v1/XXX/invoices?customerNo=XYZABC HTTP/1.1
121 Host: -
122 Authorization: Bearer <Token>
123 Content-Type: application/json
124 {{/code}}
125
126
127 {{code language="http" title="**Response**"}}
128 HTTP/1.1 200 OK
129 Content-Type: application/json
130
131 {
132 "items": [
133 {
134 "@id" : "/ledger/invoice/v1/XXX/invoices/12345",
135 "invoiceNo" : "12345",
136 "status" : "pending",
137 "claimLevel" : "Invoice",
138 "originalAmount" : 354.10,
139 "dueDate" : "2021-10-01T00:00:00",
140 "customerNo" : "XYZABC"
141 },
142 {
143 "@id" : "/ledger/invoice/v1/XXX/invoices/987654",
144 "invoiceNo" : "987654",
145 "status" : "open",
146 "claimLevel" : "Invoice",
147 "originalAmount" : 122.00,
148 "dueDate" : "2020-10-01T00:00:00",
149 "customerNo" : "XYZABC"
150 },
151 {
152 "@id" : "/ledger/invoice/v1/XXX/invoices/456321",
153 "invoiceNo" : "456321",
154 "status" : "closed",
155 "claimLevel" : "Invoice",
156 "originalAmount" : 846.50,
157 "dueDate" : "2020-08-01T00:00:00",
158 "customerNo" : "XYZABC"
159 }
160 ]
161 }
162 {{/code}}
163
164 (% class="box infomessage" %)
165 (((
166 Note! Response example below is an updated model which will be available in production on the **3rd of July 2024**. 'currency' and 'invoiceDate' has been added to the response when listing invoices for a specific customer.
167 )))
168
169 {{code language="http" title="**Response**"}}
170 HTTP/1.1 200 OK
171 Content-Type: application/json
172
173 {
174 "items": [
175 {
176 "@id" : "/ledger/invoice/v1/XXX/invoices/12345",
177 "invoiceNo" : "12345",
178 "status" : "pending",
179 "claimLevel" : "Invoice",
180 "originalAmount" : 354.10,
181 "currency" : "sek",
182 "invoiceDate" : "2021-09-15T00:00:00",
183 "dueDate" : "2021-10-01T00:00:00",
184 "customerNo" : "XYZABC"
185 },
186 {
187 "@id" : "/ledger/invoice/v1/XXX/invoices/987654",
188 "invoiceNo" : "987654",
189 "status" : "open",
190 "claimLevel" : "Invoice",
191 "originalAmount" : 122.00,
192 "currency" : "sek",
193 "invoiceDate" : "2021-09-15T00:00:00",
194 "dueDate" : "2020-10-01T00:00:00",
195 "customerNo" : "XYZABC"
196 },
197 {
198 "@id" : "/ledger/invoice/v1/XXX/invoices/456321",
199 "invoiceNo" : "456321",
200 "status" : "closed",
201 "claimLevel" : "Invoice",
202 "originalAmount" : 846.50,
203 "currency" : "sek",
204 "invoiceDate" : "2021-09-15T00:00:00",
205 "dueDate" : "2020-08-01T00:00:00",
206 "customerNo" : "XYZABC"
207 }
208 ]
209 }
210 {{/code}}
211
212 (% id="HAccountresourceproperties" %)
213 ==== Invoice resource properties ====
214
215
216 (% class="table-bordered table-striped" %)
217 |=Property|=Data type|=(% style="width: 117px;" %)Format|=Description
218 |@id |string|(% style="width:117px" %)Maxlength: |Uri of the specific account
219 |created|date|(% style="width:117px" %) |Date when the invoice was created in the system
220 |invoiceNo|string|(% style="width:117px" %)Maxlength: 50|The identifier of the account
221 |externalInvoiceId|string|(% style="width:117px" %)Maxlength: 50|External identifier of the invoice
222 |status|string|(% style="width:117px" %)Maxlength: 25|Status of the invoice(((
223 * **Pending**: the invoice has not been created yet, awaiting transactions
224 * **Open**: the invoice is open and active
225 * **Closed**: the invoice has been closed
226 )))
227 |claimLevel|string|Maxlength: 25|Current claim level of the invoice.(((
228 * **Invoice:** This is the first state the invoice get when it is created, it will have this state until due date is passed (and possibly later depending on companys claim process configuration)
229 * **RestReminder:** Reminder to pay remaining fees of the invoice (all capital has been payed) has been created/sent
230 * **Reminder:** First reminder to pay invoice that has been past due date has been creted/sent
231 * **SecondReminder:** Second reminder to pay invoice has been created/sent
232 * **CollectionClaim:** Debt collection claim has been created/sent to the customer
233 * **DebtCollection:** The invoice has been exported to other system for further handling of collection claims
234 )))
235 |currentDebt|decimal| |Total current debt of all balances (including capital / interest / fees, etc.). This value can be either positive or negative. (**positive value means it is a debt**)
236 |originalAmount|decimal|(% style="width:117px" %) |The original debt amount stated on the invoice.
237 |currency|string|(% style="width:117px" %)[[ISO 4217>>https://sv.wikipedia.org/wiki/ISO_4217]]|Currency of the invoice
238 |invoiceDate|date|(% style="width:117px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|Date when the invoice was created (printed on the invoice document)
239 |dueDate|date|(% style="width:117px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|Duedate of the invoice. This value does not exist for credit invoices
240 |seller.name|string|(% style="width:117px" %) |Name of the seller related to the invoice
241 |seller.number|string|(% style="width:117px" %) |The identifier of the seller
242 |debt|object|(% style="width:117px" %) |Current debt of the invoices separated in the different debt types
243 | debt.capital|decimal|(% style="width:117px" %) |This value only exists if there is any capital amount
244 | debt.reminderFee|decimal|(% style="width:117px" %) |This value only exists if there is any reminder fee //(also includes businessRemiderFee)//
245 | debt.collectionFee|decimal|(% style="width:117px" %) |This value only exists if there is any collection fee
246 | debt.penaltyInterest|decimal|(% style="width:117px" %) |This value only exists if there is any penalty interest
247 | debt.calculatedPenaltyInterest|decimal|(% style="width:117px" %) |Todays pending calculated penalty interest. Will be valid if a payment is made today.
248 This value only exists if there is any calculated penalty interest.
249 |penaltyInterestRate|decimal|(% style="width:117px" %)Percentage|yearly penalty interestrate (optional)
250 |bankPayment|object|(% style="width:117px" %) |optional. This object is only visible if the invoice is ready to be paid. Does not exists for invoices with status "closed", or for creditinvoices
251 | bankPayment.bankAccountNo|string|(% style="width:117px" %)Maxlength: 15|bankaccount for payment
252 | bankPayment.bankAccountType|string|(% style="width:117px" %)Maxlength: 10|BankAccountTypes:(((
253 * BKSE (swedish bank account)
254 * PKSE (swedish plusgiro)
255 * BGSE (swedish bankgiro)
256 * PGSE (swedish plusgiro OCR)
257 * BKNO (norwegian bank account)
258 * BKDK (danish bank account)
259 )))
260 | bankPayment.bic|string|(% style="width:117px" %)Maxlength: 11|Bank Identifier Code (BIC)
261 | bankPayment.iban|string|(% style="width:117px" %)Maxlength: 34|International Bank Account Number (IBAN)
262 | bankPayment.paymentReference|string|(% style="width:117px" %)Maxlength: 50|(((
263 reference to specify on the payment
264 )))
265 |customer|string|(% style="width:117px" %)Uri|Uri to the customer resource related to the invoice
266 |transactions|string|(% style="width:117px" %)Uri|List all transactions that has occured on the invoice
267 |activePaymentOrders|string|(% style="width:117px" %)Uri|View scheduled payment orders
268 |journal|string|(% style="width:117px" %)Uri|Lists events that has occured on the invoice
269 |documents|string|(% style="width:117px" %)Uri|View the actual invoice document (and other related documents), how it has been distributed etc.
270
271 (% id="HDocuments" %)
272 == Documents ==
273
274 The documents resources contains basic info of each invoice, reminder, letters etc. that has been produced related to the invoice. It also includes a url to download the actual document.
275
276
277 (% id="HListallbillsofanaccount" %)
278 ==== List all documents of an invoice ====
279
280 {{code language="http" title="**Request**"}}
281 GET /ledger/invoice/v1/XXX/invoices/NNN/documents HTTP/1.1
282 Host: -
283 Authorization: Bearer <Token>
284 Content-Type: application/json
285
286 {{/code}}
287
288
289 {{code language="http" title="**Response**"}}
290 HTTP/1.1 200 OK
291 Content-Type: application/json
292
293 {
294 "@id": "/ledger/invoice/v1/501/invoices/NNN/documents",
295 "items" : [
296 {
297 "@id": "/ledger/invoice/v1/XXX/invoices/NNN/documents/852147",
298 "date": "2018-11-15T00:00:00",
299 "type" : "invoice",
300 "distributionMethod" : "NotDistributed|Postal|Kivra|EInvoice|EMail",
301 "document": "/ledger/invoice/v1/XXX/invoices/NNN/documents/852147/document"
302 },
303 {
304 "@id": "/ledger/invoice/v1/XXX/invoices/NNN/documents/123654",
305 "date": "2018-11-15T00:00:00",
306 "type" : "reminder",
307 "distributionMethod" : "NotDistributed|Postal|Kivra|EInvoice|EMail",
308 "document": "/ledger/invoice/v1/XXX/invoices/NNN/documents/123654/document"
309 }
310 ]
311 }
312 {{/code}}
313
314 (% id="H-1" %)
315 ==== ====
316
317 (% id="HGetspecificbill" %)
318 ==== Get specific document ====
319
320 {{code language="http" title="**Request**"}}
321 GET /ledger/invoice/v1/XXX/invoices/NNN/documents/YYY HTTP/1.1
322 Host: -
323 Authorization: Bearer <Token>
324 Content-Type: application/json
325
326 {{/code}}
327
328
329 {{code language="http" title="**Response**"}}
330 HTTP/1.1 200 OK
331 Content-Type: application/json
332
333 {
334 "@id": "/ledger/invoice/v1/XXX/invoices/NNN/documents/123645",
335 "date": "2018-11-15T00:00:00",
336 "type" : "reminder",
337 "distributionMethod" : "NotDistributed|Postal|Kivra|EInvoice|EMail",
338 "document": "/ledger/invoice/v1/XXX/invoices/NNN/documents/123645/document"
339 }
340 {{/code}}
341
342 (% id="HBillresourceproperties" %)
343 ==== Document resource properties ====
344
345 (% class="table-bordered table-striped" %)
346 |=Property|=Data type|=Format|=Description
347 |@id|string|Uri|
348 |date|date|[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|Date when the document was created
349 |type|string| |(((
350 Currently available types of document
351
352 * **Invoice **- the actual invoice
353 * **Reminder **- reminder of the invoice
354 * **RestReminder **- reminder of rest amounts
355 * **Collection **- Collection claim of the invoice
356 * **CreditInvoice**
357 * **BillAttachmentTypeName**
358 ** **SA **(summary)
359 ** **SSA **(Consolidated Summary)
360 ** **SP **(Specification)
361 )))
362 |distributionMethod|string| |(((
363 * **NotDistributed **- the letter has been created but not distributed
364 * **Postal **- Distributed through usual post
365 * **Kivra **- Digitally distributed through Kivra
366 * **EInvoice **- Digitally distributed through EInvoice
367 * **EMail **- Digitally distributed through email
368 )))
369 |document|string|Uri|Uri to download the actual document, usually pdf (content type in response).
370
371 == Transactions ==
372
373 This resource lists all transactions that has occured on the invoice. The resource does not support "GET" on individual transactions, only listing of all transactions.
374 Property "typeName" is ment to be displayed directly "as is" in a customer portal, it is translated to a readable text in the language configured on the current company.
375
376
377 (% id="HListallbillsofanaccount" %)
378 ==== List all transactions that has occured on an invoice ====
379
380
381 {{code language="http" title="**Request**"}}
382 GET /ledger/invoice/v1/XXX/invoices/NNN/transactions HTTP/1.1
383 Host: -
384 Authorization: Bearer <Token>
385 Content-Type: application/json
386
387 {{/code}}
388
389
390 {{code language="http" title="**Response**"}}
391 HTTP/1.1 200 OK
392 Content-Type: application/json
393
394 {
395 "@id": "/ledger/invoice/v1/501/invoices/NNN/transactions",
396 "items" : [
397 {
398 "type": "disbursement",
399 "typeName": "Utbetalningsuppdrag skapat",
400 "reference": "",
401 "amount": 50.00,
402 "date": "2019-11-09T00:00:00"
403 },
404 {
405 "type": "payment",
406 "typeName": "Betalning",
407 "reference": "",
408 "amount": -100.00,
409 "date": "2019-11-09T00:00:00"
410 },
411 {
412 "type": "credit",
413 "typeName": "Kreditering",
414 "reference": "",
415 "amount": -100.00,
416 "date": "2019-11-02T00:00:00",
417 "cause" : {
418 "type": "bankruptcy",
419 "typeName": "Konkurs"
420 }
421 },
422 {
423 "type": "credit",
424 "typeName": "Kreditering",
425 "reference": "korrigering dröjsmålsränta",
426 "amount": -00.85,
427 "date": "2019-11-02T00:00:00",
428 "cause" : {
429 "type": "remission",
430 "typeName": "Efterskänkes"
431 }
432 },
433 {
434 "type": "credit",
435 "typeName": "Kreditering",
436 "reference": "reglering mot kreditfaktura NNN",
437 "amount": -100.00,
438 "date": "2019-11-02T00:00:00",
439 },
440 {
441 "type": "collectionFee",
442 "typeName": "Inkassoavgift",
443 "reference": "",
444 "amount": 180.00,
445 "date": "2019-11-02T00:00:00",
446 },
447 {
448 "type": "reminderFee",
449 "typeName": "Påminnelseavgift",
450 "reference": "",
451 "amount": 30.00,
452 "date": "2019-11-02T00:00:00",
453 },
454 {
455 "type": "interest",
456 "typeName": "ränta",
457 "reference": "",
458 "amount": 2.00,
459 "date": "2019-11-02T00:00:00",
460 },
461 {
462 "type": "invoice",
463 "typeName": "Faktura",
464 "reference": "butiksnamn, Orderref. 345",
465 "amount": 200.00,
466 "date": "2020-10-09T00:00:00"
467 }
468 ]
469 }
470 {{/code}}
471
472 (% id="H-1" %)
473 ==== ====
474
475 (% id="HGetspecificbill" %)
476 ==== Transaction resource properties ====
477
478 (% class="table-bordered table-striped" %)
479 |=(% style="width: 405px;" %)Property|=(% style="width: 129px;" %)Data type|=(% style="width: 1236px;" %)Description
480 |(% style="width:405px" %)@id|(% style="width:129px" %)string|(% style="width:1236px" %)
481 |(% style="width:405px" %)type|(% style="width:129px" %)string|(% style="width:1236px" %)Type of transaction
482 |(% style="width:405px" %)typeName|(% style="width:129px" %)string|(% style="width:1236px" %)(((
483 The type of transaction in form of a readable translated text (the local language of the current company)
484
485 The following types can occur on a invoice
486
487 * Invoice //(the transaction that is the basis for the invoice)//
488 * CreditInvoice// (the transaction that is the basis for the credit invoice)//
489 * Credit// (credited amount)//
490 * Interest
491 * Payment
492 * Disbursement //(If, for example, a surplus occur on the invoice, it can be paid out)//
493 * DisbursementReturned //(amount that failed to be paid out for any reason is returned on the invoice)//
494 * InvoiceFee
495 * ReminderFee
496 * CollectionFee
497 * BadDebt// (BadCapital is an expected loss that may be reclaimed if debt monitoring results in a payment from the customer)//
498 * Converted //(only available by agreement with PayEx)//
499 )))
500 |(% style="width:405px" %)reference|(% style="width:129px" %)string|(% style="width:1236px" %)Transaction reference
501 |(% style="width:405px" %)amount|(% style="width:129px" %)decimal|(% style="width:1236px" %)Amount ot the transaction
502 |(% style="width:405px" %)date|(% style="width:129px" %)date|(% style="width:1236px" %)Date when the transaction occured
503 |(% style="width:405px" %)cause|(% style="width:129px" %)object|(% style="width:1236px" %)This object is available when there is a specific cause to why the transaction has occured
504 |(% style="width:405px" %) cause.type|(% style="width:129px" %)string|(% style="width:1236px" %)Type of cause to why the transaction has occured
505 |(% style="width:405px" %) cause.typeName|(% style="width:129px" %)string|(% style="width:1236px" %)The type of cause in form of a readable translated text (in the local language of the current company)
506
507 == Active payment orders ==
508
509 This resource corresponds to an active / scheduled payment order placed against the specific account, the end-customer will be debited at the given executeDate.
510
511 (% id="HGetactivepaymentordersforanaccount" %)
512 ====
513 Get active payment orders for an account ====
514
515
516 {{code language="http" title="**Request**"}}
517 GET /ledger/invoice/v1/XXX/invoices/NNN/active-payment-orders/ HTTP/1.1
518 Host: -
519 Authorization: Bearer <Token>
520 Content-Type: application/json
521 {{/code}}
522
523
524 {{code language="http" title="**Response**"}}
525 HTTP/1.1 200 OK
526 Content-Type: application/json
527
528 {
529 "operations": null,
530 "items": [
531 {
532 "paymentMethod": "autogiro",
533 "executeDate": "2020-02-15",
534 "amount": 200.00
535 }
536 ]
537 }
538 {{/code}}
539
540 (% id="H-2" %)
541 ==== ====
542
543 (% id="HActive-payment-ordersresourceproperties" %)
544 ==== Active-payment-orders resource properties ====
545
546 (% class="table-bordered table-striped" %)
547 |=Property|=Data type|=Description
548 |paymentMethod|string|paymentMethods:(((
549 * autogiro
550 )))
551 |executeDate|Date|(((
552 The date when the customers bankaccount will be charged
553 )))
554 |amount|decimal|The amount that will be withdrawn from the bankaccount
555
556 (% id="HJournal" %)
557 == Journal ==
558
559 This resource lists all events that has occured on the invoice, in a sorted timeline.
560
561 (% id="HGetactivepaymentordersforanaccount" %)
562 ====
563 Get journal entries for the invoice ====
564
565
566 {{code language="http" title="**Request**"}}
567 GET /ledger/invoice/v1/XXX/invoices/NNN/journal/ HTTP/1.1
568 Host: -
569 Authorization: Bearer <Token>
570 Content-Type: application/json
571 {{/code}}
572
573
574 {{code language="http" title="**Response**"}}
575 HTTP/1.1 200 OK
576 Content-Type: application/json
577
578 {
579 "operations": null,
580 "items": [
581 {
582 "type": "ComplaintReceived",
583 "date" : "2020-09-01T00:00:00",
584 "description" : ""
585 },
586 {
587 "type": "SecondReminderSent",
588 "date" : "2020-09-01T00:00:00",
589 "description" : ""
590 },
591 {
592 "type": "ReminderSent",
593 "date" : "2020-09-01T00:00:00",
594 "description" : ""
595 }
596 ],
597 "view": {
598 "@id": "/ledger/invoice/v1/XXX/invoices/NNN/journal?$top=2&$skip=0",
599 "next": "/ledger/invoice/v1/XXX/invoices/NNN/journal?$top=2&$skip=2"
600 }
601 }
602 {{/code}}
603
604 (% id="H-2" %)
605 ==== ====
606
607 (% id="HActive-payment-ordersresourceproperties" %)
608 ==== Journal resource properties ====
609
610 (% class="table-bordered table-striped" %)
611 |=Property|=Data type|=Description
612 |type|string|type:(((
613 * **ReminderSent **//(an invoice reminder has been sent to the customer)//
614 * **SecondReminderSent **//(a second invoice reminder has been sent to the customer)//
615 * **CollectionClaimSent **//(a collection claim has been sent to the customer)//
616 * **RestReminderSent **//(a reminder including only interest and fees has been sent to the customer)//
617 * **DebtCollection **//(the invoice has been transferred to collection)//
618 * **Respite// //**//(the claim is stopped for further claimprocess steps until valid to data of respite or respite is removed)//
619 * **RespiteRemoved** //(respite has been removed fro claim)//
620 * **Stop// //**//(the claim is stopped for further claim process steps until stop is removed)//
621 * **StopRemoved **//(stop has been removed from claim)//
622 * **ComplaintReceived// //**//(complaint has been registered)//
623 * **ComplaintResolved **//(complaint has been resolved)//
624 * **InvoiceClosed **//(status of the invoice in the accounts receivable has been set to closed)//
625 * **PaymentOrderFailed **//(scheduled paymentorder failed to be executed)//
626 )))
627 |date|Date|(((
628 The date when the journal entry occured
629 )))
630 |description|string|detailed description of the entry (if available)
631
632 == Register direct payment ==
633
634 operation for registration of direct payments against invoices
635
636 {{code language="http" title="**Request**"}}
637 POST /ledger/invoice/v1/XXX/invoices/NNN/register-direct-payment HTTP/1.1
638 Host: -
639 Authorization: Bearer <Token>
640 Content-Type: application/json
641
642 {
643 "amount" : 100.00,
644 "paymentDate" : "2021-04-27",
645 "transactionCause" : "psp"
646 }
647 {{/code}}
648
649 (% id="HActive-payment-ordersresourceproperties" %)
650 ==== Register-direct-payment request properties ====
651
652 (% class="table-bordered table-striped" %)
653 |=Property|=Data type|=Required|=Description
654 |amount|decimal|Yes|The amount of the direct payment
655 |paymentDate|Date|Yes|(((
656 The date when the payment was made
657 )))
658 |transactionCause|string|No|(((
659 * psp
660 )))
661
662 {{code language="http" title="**Response**"}}
663 HTTP/1.1 204 NO CONTENT
664 Content-Type: application/json
665
666 {{/code}}
667
668 == Settle-credit-invoice ==
669
670 operation to settle an existing credit invoice towards debit invoice. This operation is only be available/valid on credit-invoices
671
672 {{code language="http" title="**Request**"}}
673 POST /ledger/invoice/v1/XXX/invoices/NNN/settle-credit-invoice HTTP/1.1
674 Host: -
675 Authorization: Bearer <Token>
676 Content-Type: application/json
677
678 {
679 "debitInvoiceNo": "12345",
680 "creditAmount": 250.00,
681 "sendCopy": false
682 }
683 {{/code}}
684
685 (% id="HActive-payment-ordersresourceproperties" %)
686 ==== Settle-credit-invoice request properties ====
687
688 (% class="table-bordered table-striped" %)
689 |=Property|=Data type|=Required|=Description
690 |debitInvoiceNo|string|Yes|invoice number of the debit invoice that the credit invoice is to be settled against
691 |creditAmount|decimal|Yes|(((
692 Amount of the credit invoice to use
693 )))
694 |sendCopy|bool|No|Whether a new copy should be distributed to the end-customer with updated balances (after settlement has been executed)
695 Default false
696
697 {{code language="http" title="**Response**"}}
698 HTTP/1.1 204 NO CONTENT
699 Content-Type: application/json
700
701 {{/code}}
702
703 == Remission ==
704
705 operation to allow partialy remission of the debt. Usually used if there is a small debt left on the invoice after a payment hade been done, and the remaining amount should be offered.
706
707 {{code language="http" title="**Request**"}}
708 POST /ledger/invoice/v1/XXX/invoices/NNN/remission HTTP/1.1
709 Host: -
710 Authorization: Bearer <Token>
711 Content-Type: application/json
712
713 {
714 "balanceType": "CollectionFee",
715 "amount": 12.00,
716 "invoiceCurrentDebt": 12.00
717 }
718 {{/code}}
719
720 (% id="HActive-payment-ordersresourceproperties" %)
721 ==== remission request properties ====
722
723 (% class="table-bordered table-striped" %)
724 |=Property|=Data type|=Required|=Description
725 |balanceType|string|Yes|(((
726 The balanceType to be affected
727
728 * capital
729 * reminderfee
730 * penaltyinterest
731 * collectionfee
732 )))
733 |amount|decimal|Yes|The amount of the specified balace type to exeute remission on
734 |invoiceCurrentDebt|decimal|Yes|The amount must match the current debt (**excl. Calculated interest**) on the invoice.
735 currentDebt - debt.calculatedPenaltyInterest
736
737 {{code language="http" title="**Response**"}}
738 HTTP/1.1 204 NO CONTENT
739 Content-Type: application/json
740
741 {{/code}}
742
743 == Write-down ==
744
745 operation to allow partialy or full write-down of the debt. the reason/cause of the write-down should be specified (affects accounting)
746
747 {{code language="http" title="**Request**"}}
748 POST /ledger/invoice/v1/XXX/invoices/NNN/write-down HTTP/1.1
749 Host: -
750 Authorization: Bearer <Token>
751 Content-Type: application/json
752
753 {
754 "balanceType": "CollectionFee",
755 "amount": 12.00,
756 "cause": "deceased",
757 "invoiceCurrentDebt": 462.10
758 }
759 {{/code}}
760
761 (% id="HActive-payment-ordersresourceproperties" %)
762 ==== Write-down request properties ====
763
764 (% class="table-bordered table-striped" %)
765 |=Property|=Data type|=Required|=Description
766 |balanceType|string|Yes|(((
767 The balanceType to be affected
768
769 * Capital
770 * ReminderFee
771 * PenaltyInterest
772 * CollectionFee
773 )))
774 |amount|decimal|Yes|The amount of the specified balace type to write-down
775 |cause|string|Yes|(((
776 The cause of the write-down
777
778 * Bankruptcy
779 * Settlement
780 * Deceased
781 * Fraud
782 * Dispute
783 * Unknown
784
785 If field is null, Then defaults to "Unknown". Case-Sensitive
786 )))
787 |{{{invoiceCurrentDebt}}}|decimal|Yes|The amount must match the current debt (**excl. Calculated interest**) on the invoice.
788 currentDebt - debt.calculatedPenaltyInterest
789
790 {{code language="http" title="**Response**"}}
791 HTTP/1.1 204 NO CONTENT
792 Content-Type: application/json
793
794 {{/code}}
795
796 == Respite ==
797
798 Resource to create or view respite
799
800 Get respite
801
802 {{code language="http" title="**Request**"}}
803 GET /ledger/invoice/v1/XXX/invoices/NNN/respite HTTP/1.1
804 Host: -
805 Authorization: Bearer <Token>
806 Content-Type: application/json
807
808 {{/code}}
809
810 {{code language="http" title="**Response**"}}
811 HTTP/1.1 200 OK
812 Content-Type: application/json
813
814 {
815 "validToDate": "2021-08-01",
816 "reason": "..."
817 }
818 {{/code}}
819
820 Create respite
821
822 {{code language="http" title="**Request**"}}
823 POST /ledger/invoice/v1/XXX/invoices/NNN/respite HTTP/1.1
824 Host: -
825 Authorization: Bearer <Token>
826 Content-Type: application/json
827
828 {
829 "validToDate": "2021-08-01",
830 "reason": "..."
831 }
832 {{/code}}
833
834 {{code language="http" title="**Response**"}}
835 HTTP/1.1 201 CREATED
836 Content-Type: application/json
837 {{/code}}
838
839 (% id="HActive-payment-ordersresourceproperties" %)
840 ==== Respite request properties ====
841
842 (% class="table-bordered table-striped" %)
843 |=Property|=Data type|=Required|=Description
844 |validToDate|Date|Yes|Respite is valid to this date
845 |reason|string|Yes|Reason for why the respite was created.
846
847 == Active-disbursement-orders ==
848
849 View or create disbursement orders, only available for credit-invoices
850
851 Get active-disbursement-orders
852
853 {{code language="http" title="**Request**"}}
854 GET /ledger/invoice/v1/XXX/invoices/NNN/active-disbursement-orders HTTP/1.1
855 Host: -
856 Authorization: Bearer <Token>
857 Content-Type: application/json
858
859 {{/code}}
860
861 {{code language="http" title="**Response**"}}
862 HTTP/1.1 200 OK
863 Content-Type: application/json
864
865 {
866 "items" :
867 [
868 {
869 "@id" : "../ledger/v1/501/invoices/12345/active-disbursement-orders/456789",
870 "amount" : 10,
871 "norwegianBankAccount" : {
872 "accountNo" : "1234"
873 }
874 },
875 {
876 "@id" : "../ledger/v1/501/invoices/12345/active-disbursement-orders/456788",
877 "amount" : 10,
878 "international" : {
879 "iban" : "123456",
880 "bic" : "SWED..."
881 }
882 },
883 {
884 "@id" : "../ledger/v1/501/invoices/12345/active-disbursement-orders/456787",
885 "amount" : 10,
886 "swedishBankAccount" : {
887 "accountNo" : "123",
888 "accountType" : "BKSE | PGSE | BGSE"
889 }
890 },
891 {
892 "@id" : "../ledger/v1/501/invoices/12345/active-disbursement-orders/456786",
893 "amount" : 10,
894 "swedishSus" : {
895 "nationalIdentifier": {
896 "regNo" : "YYYYMMDD-NNNN",
897 "countryCode" : "SE"
898 },
899 "address" : {
900 "addressee" : "Kalle Axelstopp",
901 "streetAddress" : "Axelgatan 18",
902 "coAddress" : null,
903 "city" : "STOCKHOLM",
904 "zipCode" : "16872",
905 "countryCode" : "se"
906 }
907 }
908 }
909 ]
910 }
911 {{/code}}
912
913 Create disbursement order towards a norwegian bank account
914
915 {{code language="http" title="**Request**"}}
916 POST /ledger/invoice/v1/XXX/invoices/NNN/active-disbursement-orders HTTP/1.1
917 Host: -
918 Authorization: Bearer <Token>
919 Content-Type: application/json
920
921 {
922 "amount" : 10,
923 "norwegianBankAccount" : {
924 "accountNo" : "1234"
925 }
926 }
927 {{/code}}
928
929 Create disbursement order towards a international bank account (IBAN)
930
931 {{code language="http" title="**Request**"}}
932 POST /ledger/invoice/v1/XXX/invoices/NNN/active-disbursement-orders HTTP/1.1
933 Host: -
934 Authorization: Bearer <Token>
935 Content-Type: application/json
936
937 {
938 "amount" : 10,
939 "international" : {
940 "iban" : "123456",
941 "bic" : "SWED..."
942 }
943 }
944 {{/code}}
945
946 Create disbursement order towards a swedish bank account
947
948 {{code language="http" title="**Request**"}}
949 POST /ledger/invoice/v1/XXX/invoices/NNN/active-disbursement-orders HTTP/1.1
950 Host: -
951 Authorization: Bearer <Token>
952 Content-Type: application/json
953
954 {
955 "amount" : 100,
956 "swedishBankAccount" : {
957 "accountNo" : "123",
958 "accountType" : "BKSE | PGSE | BGSE"
959 }
960 }
961 {{/code}}
962
963 Create disbursement order using "Swedbanks lön- och utbetalningssystem (SUS)"
964
965 {{code language="http" title="**Request**"}}
966 POST /ledger/invoice/v1/XXX/invoices/NNN/active-disbursement-orders HTTP/1.1
967 Host: -
968 Authorization: Bearer <Token>
969 Content-Type: application/json
970
971 {
972 "amount" : 100,
973 "swedishSus" : {
974 "nationalIdentifier": {
975 "regNo" : "YYYYMMDD-NNNN",
976 "countryCode" : "SE"
977 },
978 "address" : {
979 "addressee" : "Kalle Axelstopp",
980 "streetAddress" : "Axelgatan 18",
981 "coAddress" : null,
982 "city" : "STOCKHOLM",
983 "zipCode" : "16872",
984 "countryCode" : "se",
985 }
986 }
987 }
988 {{/code}}
989
990
991 {{code language="http" title="**Response**"}}
992 HTTP/1.1 201 CREATED
993 Content-Type: application/json
994 {{/code}}
995
996 (% id="HActive-payment-ordersresourceproperties" %)
997 ==== Respite request properties ====
998
999 (% class="table-bordered table-striped" %)
1000 |=Property|=Data type|=Required|=Description
1001 |amount|decimal|Yes|
1002 |__**norwegianBankAccount**__|object|No*|
1003 | accountNo|string|Yes|
1004 |__**swedishBankAccount**__|object|No*|
1005 | clearingNo|string|Yes|
1006 | accountNo|string|Yes|
1007 |__**international**__|object|No*|
1008 | iban|string|Yes|
1009 | bic|string|Yes|
1010 |__**swedishSus**__|object|No*|
1011 |**nationalIdentifier**|object|Yes|
1012 | regNo|string|Yes|
1013 | countryCode|string|Yes|
1014 |**address**|object|Yes|
1015 | addressee|string|Yes|
1016 | streetAddress|string|No|
1017 | coAddress|string|No|
1018 | city|string|Yes|
1019 | zipCode|string|Yes|
1020 | countryCode|string|Yes|
1021 | | | |
1022
1023 //* One and only one of the specified objects can be set at each request//
1024
1025 == Transfer-to-account ==
1026
1027 operation transfer current capital debt on the invoice to a provided account. This will close the invoice.
1028
1029 {{code language="http" title="**Request**"}}
1030 POST /ledger/invoice/v1/XXX/invoices/NNN/transfer-to-account HTTP/1.1
1031 Host: -
1032 Authorization: Bearer <Token>
1033 Content-Type: application/json
1034
1035 {
1036 "accountNo" : "123",
1037
1038 }
1039
1040 {{/code}}
1041
1042 (% id="HActive-payment-ordersresourceproperties" %)
1043 ==== Transfer-to-account request properties ====
1044
1045 (% class="table-bordered table-striped" %)
1046 |=Property|=Data type|=Required|=Description
1047 |accountNo|string|Yes|account number to the to transfer current capital debt into
1048
1049 {{code language="http" title="**Response**"}}
1050 HTTP/1.1 204 NO CONTENT
1051 Content-Type: application/json
1052
1053 {{/code}}
1054
1055 == ==
1056
1057 == Generate-invoice-portal-link ==
1058
1059 Creates a new public available (no authorization needed) link to the targeted invoice. Default lifetime of a link is 120 days. Creating new links does not affect old links.
1060
1061 {{code language="http" title="**Request**"}}
1062 POST /ledger/invoice/v1/XXX/invoices/NNN/generate-invoice-portal-link HTTP/1.1
1063 Host: -
1064 Authorization: Bearer <Token>
1065 Content-Type: application/json
1066
1067 {
1068 }
1069
1070 {{/code}}
1071
1072 (% id="HActive-payment-ordersresourceproperties" %)
1073 ==== ====
1074
1075 {{code language="http" title="**Response**"}}
1076 HTTP/1.1 200 OK
1077 Content-Type: application/json
1078
1079 {
1080 "invoicePortalLink": "https://public-invoice-example.com/sv/XXX?token=eyJhbGciOiJSUzI1Ni..."
1081 }
1082 {{/code}}
1083
1084 {{display reference="developer:Main.Invoicing.ledger-api-general-docs.api-section-problems.WebHome"/}}
1085
1086 === Problem types ===
1087
1088 (% class="box infomessage" %)
1089 (((
1090 Note, each problem typecode is preceded by "ledger/invoice/v1/problems/" in this API, e.g. the error "validation" in the table below will appear as typecode "ledger/invoice/v1/problems/validation".
1091 )))
1092
1093 (% class="table-bordered table-striped" %)
1094 |=(% style="width: 537px;" %)Problem type (code)|=(% style="width: 172px;" %)Httpstatus|=(% style="width: 796px;" %)Description
1095 |(% style="width:537px" %)forbidden|(% style="width:172px" %)403|(% style="width:796px" %)occurs if access to method is not allowed.
1096 |(% style="width:537px" %)customer-not-found|(% style="width:172px" %)404|(% style="width:796px" %)can occur if customernumber is part of the querystring towards invoice resource
1097 |(% style="width:537px" %)invoice-not-found|(% style="width:172px" %)404|(% style="width:796px" %)
1098 |(% style="width:537px" %)missing-offer|(% style="width:172px" %)409|(% style="width:796px" %)Invoice is not a candidate for **transfer-to-account**. This has nothing to do with the provided Account
1099 |(% style="width:537px" %)missing-account-for-billing-account|(% style="width:172px" %)409|(% style="width:796px" %)No account found on the provided AccountNo, can be expected on the us of **transfer-to-account** operation
1100 |(% style="width:537px" %)not-acceptable-for-conversion|(% style="width:172px" %)409|(% style="width:796px" %)Invoice or account was not acceptable for transfer. This could be caused a number of parameters both on the invoice and the account.
1101 |(% style="width:537px" %)credit-check-rejected|(% style="width:172px" %)422|(% style="width:796px" %)Score does not approve the conversion
1102 |(% style="width:537px" %)customer-mismatch|(% style="width:172px" %)422|(% style="width:796px" %)Invoice and account is on separate customers in the **transfer-to-account** request
1103 |(% style="width:537px" %) |(% style="width:172px" %) |(% style="width:796px" %)