Wiki source code of 4. Invoice

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