Wiki source code of account

Last modified by David Persson on 2024/02/21 07:42
Show last authors
1 (% class="jumbotron" %)
2 (((
3 (% class="container" %)
4 (((
5 Integrate to **PayEx Account API **
6 )))
7 )))
8
9 === Changelog ===
10
11
12 (% id="HRoutesegments" %)
13 == Introduction ==
14
15 (% class="lead" %)
16 This api is used to retrieve information and to change properties related to the customer's account.
17
18 [[image:1692966354374-564.png||height="496" width="416"]]
19
20
21 Each resource in the API corresponds to its own route. All routes are structured according to a specific standard, explained below
22
23 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.
24 //api.payex.com/ledger/**{Subdomain}**/v1/**{LedgerNumber}**/resource1/**{resource1Id}**/resource2/**{resource2Id}**/resource3/**{resource3Id}**//
25
26 (% class="table-bordered table-striped" %)
27 |=(% style="width: 604px;" %)Route segment|=(% style="width: 2790px;" %)Description
28 |(% style="width:604px" %)Subdomain|(% style="width:2790px" %)In this part of the API it will be account
29 |(% style="width:604px" %)LedgerNumber|(% style="width:2790px" %)The ledger identifier/number at PayEx
30 |(% style="width:604px" %)resource1Id|(% style="width:2790px" %)Identifier of resource1
31 |(% style="width:604px" %)resource2Id|(% style="width:2790px" %)identifier of resource2, subresource to resource1
32 |(% style="width:604px" %)resource3Id|(% style="width:2790px" %)identifier of resource3, subresource to resource2
33
34 (% class="wikigeneratedid" %)
35 Routes that occurs in examples of this documentation will use the following identifiers
36
37 (% class="table-bordered table-striped" %)
38 |=(% style="width: 488px;" %)Resource|=(% style="width: 2271px;" %)Identifier
39 |(% style="width:488px" %)LedgerNumber|(% style="width:2271px" %)XXX
40 |(% style="width:488px" %)Accounts|(% style="width:2271px" %)NNN
41 |(% style="width:488px" %)Bills|(% style="width:2271px" %)reminder-123
42 bill-456
43 |(% style="width:488px" %)Cards|(% style="width:2271px" %)954c8699-b38f-47a2-b568-668b8837dad8
44 274c8699-b38f-47a2-b568-668b8837dat7
45
46 == Accounts ==
47
48 The **accounts** resource is located under **ledger/account/v1/ **api**. **The accounts- and its sub-resources are used to create, read and modify information related to a account.
49 The accounts resource provides an overview of the end customer's account, it contains information such as current balance, credit limit etc. The resource also contains URIs for additional sub-resources such as bills, cards, recurring payments, etc.
50
51 The following operations is supported
52
53 * Change the account credit limit
54 * Add extra cards
55 * Request cancellation of account
56 * Turn on/off charity donation
57 * Set behaviour of recurring payments
58
59 ==== Get a list of accounts ====
60
61 ==== ====
62
63 These querystring parameters are optional. preferably select one or the other, If both accountNo and customerNo is provided in querystring accountNo have to belong to the customerNo
64
65 {{code language="http" title="**Request**"}}
66 GET /ledger/account/v1/XXX/accounts?accountNo=123&customerNo=456 HTTP/1.1
67 Host: -
68 Authorization: Bearer <Token>
69 Content-Type: application/json
70 {{/code}}
71
72
73 {{code language="http" title="**Response**"}}
74 HTTP/1.1 200 OK
75 Content-Type: application/json
76 {
77 "items": [
78 {
79 "@id": "/ledger/account/v1/XXX/accounts/NNN",
80 "accountNo": "1234567",
81 "startDate": "2018-05-21",
82 "description": null,
83 "accountProfileType": "accountType1 | accountType2 | accountType3 etc.",
84 "accountAlias" : "accountAlias1 | accountAlias2 etc.",
85 "customerNo" : "123789654",
86 "status" : "Open | PendingClose | Closed",
87 "creditLimit": 2000.00,
88 "totalBalance" : -1900.00,
89 "reservedAmount": 50.00,
90 "availableAmount": 3850.00,
91 "maxPaymentAmount": 51900.00,
92 "openBill" : "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-456",
93 "charityDonation": true,
94 "interestRate": {
95 "debtInterest" : 10.00,
96 "penaltyInterest": 15.00
97 },
98 "bankPayment": {
99 "bankAccountNo": "123",
100 "bankAccountType": "BGSE",
101 "bic": "123456",
102 "iban": "SE12345678945631",
103 "paymentReference": "54867165675646"
104 },
105 "activePaymentOrders": "/ledger/account/v1/XXX/accounts/NNN/active-payment-orders",
106 "recurringPaymentConfiguration": "/ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration",
107 "cards": "/ledger/account/v1/XXX/accounts/123456/cards",
108 "transactions": "/ledger/account/v1/XXX/accounts/NNN/transactions",
109 "currency": "sek",
110 "bills": "/ledger/account/v1/XXX/accounts/NNN/bills",
111 "customer": "/ledger/customers/v1/XXX/customer/123456",
112 "operation" : [
113 {
114 "rel" : "add-card-info",
115 "method" : "post",
116 "href" : "/ledger/account/v1/XXX/accounts/NNN/cards"
117 },
118 {
119 "rel" : "request-close-account",
120 "method" : "post",
121 "href" : "/ledger/account/v1/XXX/accounts/NNN/request-close-account"
122 },
123 {
124 "rel" : "apply-for-raised-credit-limit",
125 "method" : "post",
126 "href" : "/ledger/account-onboardings/v1/XXX/accounts/NNN/apply-for-raised-credit-limit"
127 },
128 {
129 "rel" : "partial-update",
130 "method" : "patch",
131 "href" : "/ledger/account-onboardings/v1/XXX/accounts/NNN"
132 }
133 ]
134 }
135 ],
136 "navigation": {
137 "@id": "/ledger/account/v1/XXX/accounts",
138 "first": "/ledger/account/v1/XXX/accounts?skip=0",
139 "previous": "/ledger/account/v1/XXX/accounts?skip=0"
140 }
141 }
142 {{/code}}
143
144 ==== Get a specific account ====
145
146 ==== ====
147
148 {{code language="http" title="**Request**"}}
149 GET /ledger/account/v1/XXX/accounts/NNN HTTP/1.1
150 Host: -
151 Authorization: Bearer <Token>
152 Content-Type: application/json
153 {{/code}}
154
155
156 {{code language="http" title="**Response**"}}
157 HTTP/1.1 200 OK
158 Content-Type: application/json
159
160 {
161 "@id": "/ledger/account/v1/XXX/accounts/NNN",
162 "accountNo": "1234567",
163 "startDate": "2018-05-21",
164 "description": null,
165 "accountProfileType": "accountType1 | accountType2 | accountType3 etc.",
166 "accountAlias" : "accountAlias1 | accountAlias2 etc.",
167 "customerNo" : "123789654",
168 "status" : "Open | PendingClose | Closed",
169 "creditLimit": 2000.00,
170 "totalBalance" : -1900.0,
171 "reservedAmount": 50.0,
172 "availableAmount": 3850.0,
173 "maxPaymentAmount": 51900.0,
174 "openBill" : "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-456",
175 "charityDonation": true,
176 "interestRate": {
177 "debtInterest" : 10.00,
178 "penaltyInterest": 15.00
179 },
180 "bankPayment": {
181 "bankAccountNo": "123",
182 "bankAccountType": "BGSE",
183 "bic": "123456",
184 "iban": "SE12345678945631",
185 "paymentReference": "54867165675646"
186 },
187 "activePaymentOrders": "/ledger/account/v1/XXX/accounts/NNN/active-payment-orders",
188 "recurringPaymentConfiguration": "/ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration",
189 "cards": "/ledger/account/v1/XXX/accounts/123456/cards",
190 "transactions": "/ledger/account/v1/XXX/accounts/NNN/transactions",
191 "currency": "sek",
192 "bills": "/ledger/account/v1/XXX/accounts/NNN/bills",
193 "customer": "/ledger/customers/v1/XXX/customer/123456",
194 "operation" : [
195 {
196 "rel" : "add-card-info",
197 "method" : "post",
198 "href" : "/ledger/account/v1/XXX/accounts/NNN/cards"
199 },
200 {
201 "rel" : "request-close-account",
202 "method" : "post",
203 "href" : "/ledger/account/v1/XXX/accounts/NNN/request-close-account"
204 },
205 {
206 "rel" : "apply-for-raised-credit-limit",
207 "method" : "post",
208 "href" : "/ledger/account-onboardings/v1/XXX/accounts/NNN/apply-for-raised-credit-limit"
209 },
210 {
211 "rel" : "partial-update",
212 "method" : "patch",
213 "href" : "/ledger/account-onboardings/v1/XXX/accounts/NNN"
214 }
215 ]
216 }
217 {{/code}}
218
219 ==== Change charitydonation ====
220
221 {{code language="http" title="**Request**"}}
222 PATCH /ledger/account/v1/XXX/accounts/NNN HTTP/1.1
223 Host: -
224 Authorization: Bearer <Token>
225 Content-Type: application/json
226
227 {
228 "charityDonation": false
229 }
230 {{/code}}
231
232 {{code language="http" title="**Response**"}}
233 HTTP/1.1 204 NO CONTENT
234 Content-Type: application/json
235
236 {{/code}}
237
238 ==== Request for closing an account ====
239
240 {{code language="http" title="**Request**"}}
241 POST /ledger/account/v1/XXX/accounts/NNN/request-close-account HTTP/1.1
242 Host: -
243 Authorization: Bearer <Token>
244 Content-Type: application/json
245
246 {{/code}}
247
248 {{code language="http" title="**Response**"}}
249 HTTP/1.1 204 NO CONTENT
250 Content-Type: application/json
251
252 {{/code}}
253
254 ==== Lower the creditlimit ====
255
256 The creditlimit can only be lowered through this patch API call. Increasing of the creditlimit requires signing and has not been implemented yet.
257
258 {{code language="http" title="**Request**"}}
259 PATCH /ledger/account/v1/XXX/accounts/NNN HTTP/1.1
260 Host: -
261 Authorization: Bearer <Token>
262 Content-Type: application/json
263
264 {
265 "creditLimit": 2000.00
266 }
267 {{/code}}
268
269
270 {{code language="http" title="**Response**"}}
271 HTTP/1.1 204 NO CONTENT
272 Content-Type: application/json
273
274 {{/code}}
275
276 ==== Account resource properties ====
277
278 (% class="table-bordered table-striped" %)
279 |=(% style="width: 215px;" %)Property|=(% style="width: 114px;" %)Data type|=(% style="width: 161px;" %)Format|=(% style="width: 61px;" %)Modify (patch)|=(% style="width: 877px;" %)Description
280 |(% style="width:215px" %)@id |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: |(% style="width:61px" %) |(% style="width:877px" %)Uri of the specific account
281 |(% style="width:215px" %)accountNo |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 50|(% style="width:61px" %) |(% style="width:877px" %)The identifier of the account
282 |(% style="width:215px" %)startDate |(% style="width:114px" %)date|(% style="width:161px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:61px" %) |(% style="width:877px" %)Date when the account was started
283 |(% style="width:215px" %)description |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 200|(% style="width:61px" %) |(% style="width:877px" %)A description of the type of account
284 |(% style="width:215px" %)accountProfileType |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 50|(% style="width:61px" %) |(% style="width:877px" %)The defined code of the accounttype, //Examples: kontodebet, kontokredit, kontofaktura//
285 |(% style="width:215px" %)accountAlias |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 50|(% style="width:61px" %) |(% style="width:877px" %)A descriptive name for the account type, //Examples: kontokredit1, matkonto1//
286 |(% style="width:215px" %)customerNo |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 50|(% style="width:61px" %) |(% style="width:877px" %)Identifier of the customer (account owner)
287 |(% style="width:215px" %)status |(% style="width:114px" %)string|(% style="width:161px" %)Maxlength: 25|(% style="width:61px" %) |(% style="width:877px" %)Status of the account(((
288 * **PendingClose**: the customer has requested the account to be closed, the account will be closed when possible.
289 * **Open**: the account is open and active
290 * **Closed**: the account has been closed
291 )))
292 |(% style="width:215px" %)creditLimit |(% style="width:114px" %)decimal|(% style="width:161px" %) |(% style="background-color:palegreen; width:61px" %) |(% style="width:877px" %)The creditlimit of the account, support patch operation but only lower. This value can only be 0 or positive.
293 |(% style="width:215px" %)totalBalance|(% style="width:114px" %)decimal|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Total current sum of all balances (including capital / interest / fees, etc.). This value can be either positive or negative. Negative means it is a surplus and positive means it is a debt.
294 |(% style="width:215px" %)reservedAmount |(% style="width:114px" %)decimal|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Sum of all outstanding reservations (which are valid and not captured). This value can only be positive.
295 |(% style="width:215px" %)availableAmount |(% style="width:114px" %)decimal|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Available credit (cannot be calculated from the above amounts as fees can be included there, which does not affect available credit). This value can only be positive.
296 |(% style="width:215px" %)maxPaymentAmount|(% style="width:114px" %)decimal|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)The largest amount possible to deposit on the account at this moment.
297 |(% style="width:215px" %)openBill|(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
298 |(% style="width:215px" %)charityDonation |(% style="width:114px" %)bool|(% style="width:161px" %) |(% style="background-color:palegreen; width:61px" %) |(% style="width:877px" %)If donations should be made from the account
299 |(% style="width:215px" %)interestRate.debtInterest|(% style="width:114px" %)decimal|(% style="width:161px" %)Percentage|(% style="width:61px" %) |(% style="width:877px" %)yearly debt interestrate
300 |(% style="width:215px" %)interestRate.penaltyInterest|(% style="width:114px" %)decimal|(% style="width:161px" %)Percentage|(% style="width:61px" %) |(% style="width:877px" %)yearly penalty interestrate
301 |(% style="width:215px" %)bankPayment|(% style="width:114px" %)object|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Details on how to make a bank payment to the account
302 |(% style="width:215px" %) bankAccountNo|(% style="width:114px" %)string|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Bank account number for payments against the current account
303 |(% style="width:215px" %) bankAccountType|(% style="width:114px" %)string|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)(((
304 Type of bank account
305
306 * BGSE
307 * PGSE
308 * BKNO
309 )))
310 |(% style="width:215px" %) bic|(% style="width:114px" %)string|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)BIC/SWIFT (Business Identifier Code)
311 |(% style="width:215px" %) iban|(% style="width:114px" %)string|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)IBAN (International Bank Account Number)
312 |(% style="width:215px" %) paymentReference|(% style="width:114px" %)string|(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)Payment reference of the current account
313 |(% style="width:215px" %)recurringPaymentConsent|(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
314 |(% style="width:215px" %)cards |(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
315 |(% style="width:215px" %)transactions |(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
316 |(% style="width:215px" %)currency |(% style="width:114px" %)string|(% style="width:161px" %)[[ISO 4217>>https://sv.wikipedia.org/wiki/ISO_4217]]|(% style="width:61px" %) |(% style="width:877px" %)
317 |(% style="width:215px" %)bills |(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
318 |(% style="width:215px" %)customer |(% style="width:114px" %)string|(% style="width:161px" %)Uri|(% style="width:61px" %) |(% style="width:877px" %)
319 |(% style="width:337px" %)activePaymentOrder.paymentMethod|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 15|(% style="width:61px" %)(((
320
321 )))|(% style="width:877px" %)(((
322 PaymentTypes:
323
324 * AUTOGIRO
325 )))
326 |(% style="width:337px" %)activePaymentOrder.executionDate|(% style="width:205px" %)date|(% style="width:208px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:61px" %) |(% style="width:877px" %)Date when the paymentorder will be executed (when end-customer will be debited)
327 |(% style="width:337px" %)activePaymentOrder.amount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:61px" %) |(% style="width:877px" %)Amount that will be charged, this amount may be adjusted when the payment order is executed, if the "amount to pay" on the bill has decreased
328 |(% style="width:215px" %) |(% style="width:114px" %) |(% style="width:161px" %) |(% style="width:61px" %) |(% style="width:877px" %)
329
330 ----
331
332 ==== Register-psp-payment ====
333
334 Method: POST
335 Execution of this operation will result in an attempt to deposit the amount on the given account.
336
337 (% class="box infomessage" %)
338 (((
339 Access to this operation is not normally granted, unless otherwise agreed.
340 )))
341
342 {{code language="http" title="**Request**"}}
343 POST /ledger/account/v1/XXX/accounts/NNN/register-psp-payment HTTP/1.1
344 Host: -
345 Authorization: Bearer <Token>
346 Content-Type: application/json
347
348 {
349 "Amount": 2000.00,
350 "PaymentDate": "2021-01-01",
351 "sourcePspPaymentTransactionId": "123456789"
352 }
353 {{/code}}
354
355
356 {{code language="http" title="**Response**"}}
357 HTTP/1.1 204 NO CONTENT
358 Content-Type: application/json
359
360 {{/code}}
361
362 ===== Register-psp-payment resource properties =====
363
364 (% class="table-bordered table-striped" %)
365 |=(% style="width: 161px;" %)Property|=(% style="width: 121px;" %)Data type|=(% style="width: 195px;" %)Format|=(% style="width: 1309px;" %)Description
366 |(% style="width:161px" %)Amount|(% style="width:121px" %)Decimal|(% style="width:195px" %) |(% style="width:1309px" %)Amount to deposit on account, max value is found on the account resource in the property "MaxPaymentAmount".
367 |(% style="width:161px" %)PaymentDate|(% style="width:121px" %)Date|(% style="width:195px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:1309px" %)Date of the actual payment
368 |(% style="width:161px" %)sourcePspPaymentTransactionId|(% style="width:121px" %)String|(% style="width:195px" %)Maxlength: 50|(% style="width:1309px" %)Unique identifier for the payment
369
370 ----
371
372 == Bills ==
373
374 The bills resources contains all the documents produced in the accounts billing cycle.
375
376
377 ==== List all bills of an account ====
378
379
380 {{code language="http" title="**Request**"}}
381 GET /ledger/account/v1/XXX/accounts/NNN/bills HTTP/1.1
382 Host: -
383 Authorization: Bearer <Token>
384 Content-Type: application/json
385
386 {{/code}}
387
388
389 {{code language="http" title="**Response**"}}
390 HTTP/1.1 200 OK
391 Content-Type: application/json
392
393 {
394 "@id": "/ledger/account/v1/501/accounts/NNN/bills?status=open",
395 "items" : [
396 {
397 "@id": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-123645",
398 "dueDate": "2018-12-05",
399 "billDate": "2018-11-15",
400 "billNo": "124645",
401 "billAmount": 240.00,
402 "billType" : "reminder",
403 "status": "open",
404 "externalBillId": "27",
405 "activePaymentDetails": {
406 "minimumAmountToBePayed": 240.00,
407 "bankAccountNo": "123",
408 "bankAccountType": "BGSE",
409 "bic": "123456",
410 "iban": "SE12345678945631",
411 "paymentReference": "5465164654663",
412 "paymentOrdersExists": true,
413 },
414 "document": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-124645/document"
415 },
416 {
417 "@id": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-123645",
418 "dueDate": "2018-12-05",
419 "billDate": "2018-11-15",
420 "billNo": "124645",
421 "billAmount": 240.00,
422 "billType" : "bill",
423 "status": "closed",
424 "externalBillId": "37",
425 "activePaymentDetails": null,
426 "document": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-124645/document"
427 },
428 {
429 "@id": "/ledger/account/v1/XXX/accounts/NNN/bills/bill-123645",
430 "dueDate": "2018-12-05",
431 "billDate": "2018-11-15",
432 "billNo": "124645",
433 "billAmount": 240.00,
434 "billType" : "bill",
435 "status": "closed",
436 "externalBillId": "47",
437 "activePaymentDetails": null,
438 "document": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-124645/document"
439 }
440 ]
441 }
442 {{/code}}
443
444 ==== ====
445
446 ==== Get specific bill ====
447
448
449 {{code language="http" title="**Request**"}}
450 GET /ledger/account/v1/XXX/accounts/NNN/bills/456 HTTP/1.1
451 Host: -
452 Authorization: Bearer <Token>
453 Content-Type: application/json
454
455 {{/code}}
456
457
458 {{code language="http" title="**Response**"}}
459 HTTP/1.1 200 OK
460 Content-Type: application/json
461
462 {
463 "@id": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-123645",
464 "dueDate": "2018-12-05",
465 "billDate": "2018-11-15",
466 "billNo": "124645",
467 "billAmount": 240.00,
468 "billType" : "reminder",
469 "status": "open",
470 "externalBillId": "42",
471 "activePaymentDetails": {
472 "minimumAmountToBePayed": 240.00,
473 "bankAccountNo": "123",
474 "bankAccountType": "BGSE",
475 "bic": "123456",
476 "iban": "SE12345678945631",
477 "paymentReference": "5465164654663",
478 "paymentOrdersExists": true,
479 },
480 "document": "/ledger/account/v1/XXX/accounts/NNN/bills/reminder-124645/document"
481 }
482 {{/code}}
483
484 ==== Bill resource properties ====
485
486 (% class="table-bordered table-striped" %)
487 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 621px;" %)Description
488 |(% style="width:337px" %)@id|(% style="width:205px" %)string|(% style="width:208px" %)Uri|(% style="width:621px" %)
489 |(% style="width:337px" %)dueDate|(% style="width:205px" %)date|(% style="width:208px" %)[[ISO 8601>>url:http://en.wikipedia.org/wiki/ISO_8601||rel="noreferrer" title="ISO8601 on Wikipedia"]]|(% style="width:621px" %)
490 |(% style="width:337px" %)billDate|(% style="width:205px" %)date|(% style="width:208px" %) |(% style="width:621px" %)Date when bill was created
491 |(% style="width:337px" %)billNo|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 50|(% style="width:621px" %)The identifier of the bill
492 |(% style="width:337px" %)billAmount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:621px" %)the amount that is stated on the actual bill/document
493 |(% style="width:337px" %)billType|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 25|(% style="width:621px" %)(((
494 BillTypes:
495
496 * Bill
497 * Reminder1
498 * Reminder2
499 * Collection
500 )))
501 |(% style="width:337px" %)status|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:621px" %)(((
502 "open" / "closed"
503 )))
504 |(% style="width:337px" %)externalBillId|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:621px" %)Optional external reference
505 |(% style="width:337px" %)activePaymentDetails|(% style="width:205px" %)object|(% style="width:208px" %) |(% style="width:621px" %)only set if status of bill is "open"
506 |(% style="width:337px" %)activePaymentDetails.minimumAmountToBePayed|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:621px" %)The least amount to pay on the bill
507 |(% style="width:337px" %)activePaymentDetails.bankAccountNo|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 15|(% style="width:621px" %)bankaccount for payment
508 |(% style="width:337px" %)activePaymentDetails.bankAccountType|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 10|(% style="width:621px" %)BankAccountTypes:(((
509 * BKSE (swedish bankaccount)
510 * PKSE (swedish plusgiro)
511 * BGSE (swedish bankgiro)
512 * PGSE (swedish plusgiro OCR)
513 )))
514 |(% style="width:337px" %)activePaymentDetails.bic|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 11|(% style="width:621px" %)Bank Identifier Code (BIC)
515 |(% style="width:337px" %)activePaymentDetails.iban|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 34|(% style="width:621px" %)International Bank Account Number (IBAN)
516 |(% style="width:337px" %)activePaymentDetails.paymentReference|(% style="width:205px" %)string|(% style="width:208px" %)Maxlength: 50|(% style="width:621px" %)reference to specify on the payment
517 |(% style="width:337px" %)activePaymentDetails.paymentOrdersExists|(% style="width:205px" %)bool|(% style="width:208px" %) |(% style="width:621px" %)if there is an active payment order to be executed related to this bill for "recurring payments".
518 //More detailed information about the payment order can be found on the accounts resource//
519 |(% style="width:337px" %)document|(% style="width:205px" %)string|(% style="width:208px" %)Url|(% style="width:621px" %)Url to download pdf document
520
521 == Cards ==
522
523 ==== Add card to account ====
524
525 Execute http post towards this resource to add a new card to the specified account
526
527 {{code language="http" title="**Request**"}}
528 POST /ledger/account/v1/XXX/accounts/NNN/cards HTTP/1.1
529 Host: -
530 Authorization: Bearer <Token>
531 Content-Type: application/json
532
533 {
534 "token": "954c8699-b38f-47a2-b568-668b8837dad8",
535 "PanTrunc": "85479*********648",
536 "deleted" : false,
537 "mainCard": true,
538 "cardHolder" : {
539 "number" : "123465",
540 "name": "test testsson",
541 "nationalConsumerIdentifier": {
542 "value": "19101010-1010",
543 "countryCode": "SE"
544 }
545 }
546 }
547 {{/code}}
548
549 ==== Add replacement card ====
550
551 This operation is used to replace an existing card, and is therefore executed on the card to be replaced. The contract of the postbody is the same as POST towards the cards resource.
552
553 {{code language="http" title="**Request**"}}
554 POST /ledger/account/v1/XXX/accounts/NNN/cards/954c8699-b38f-47a2-b568-668b8837dad8/add-replacement-card HTTP/1.1
555 Host: -
556 Authorization: Bearer <Token>
557 Content-Type: application/json
558
559 {
560 "token": "954c8699-b38f-47a2-b568-668b8837dad8",
561 "PanTrunc": "85479*********648",
562 "deleted" : false,
563 "mainCard": true,
564 "cardHolder" : {
565 "number" : "123465",
566 "name": "test testsson",
567 "nationalConsumerIdentifier": {
568 "value": "19101010-1010",
569 "countryCode": "SE"
570 }
571 }
572 }
573 {{/code}}
574
575 ==== List cards on an account ====
576
577 {{code language="http" title="**Request**"}}
578 GET /ledger/account/v1/XXX/accounts/NNN/cards HTTP/1.1
579 Host: -
580 Authorization: Bearer <Token>
581 Content-Type: application/json
582
583
584 {{/code}}
585
586
587 {{code language="http" title="**Response**"}}
588 HTTP/1.1 200 OK
589 Content-Type: application/json
590
591 {
592 "operations": null,
593 "items": [
594 {
595 "token": "954c8699-b38f-47a2-b568-668b8837dad8",
596 "PanTrunc": "85479*********648",
597 "deleted" : false,
598 "mainCard": true,
599 "cardHolder" : {
600 "number" : "123465",
601 "name": "test testsson",
602 "nationalConsumerIdentifier": {
603 "value": "19101010-1010",
604 "countryCode": "SE"
605 }
606 },
607 "@id": "/ledger/account/v1/XXX/accounts/NNN/cards/741"
608 },
609 {
610 "token": "274c8699-b38f-47a2-b568-668b8837dat7",
611 "PanTrunc": "78979*********321",
612 "deleted" : false,
613 "mainCard": false,
614 "cardHolder" : {
615 "number" : "987654",
616 "name": "test testsson",
617 "nationalConsumerIdentifier": {
618 "value": "19101010-1010",
619 "countryCode": "SE"
620 }
621 },
622 "@id": "/ledger/account/v1/XXX/accounts/NNN/cards/274c8699-b38f-47a2-b568-668b8837dat7"
623 }
624 ],
625 "@id": "/ledger/account/v1/XXX/accounts/NNN/cards",
626 "view": {
627 "@id": "/ledger/account/v1/XXX/accounts/NNN/cards?$top=2&$skip=0",
628 "next": "/ledger/account/v1/XXX/accounts/NNN/cards?$top=2&$skip=2"
629 }
630 }
631 {{/code}}
632
633 ==== Get a specific card ====
634
635
636 {{code language="http" title="**Request**"}}
637 GET /ledger/account/v1/XXX/accounts/NNN/cards/954c8699-b38f-47a2-b568-668b8837dad8 HTTP/1.1
638 Host: -
639 Authorization: Bearer <Token>
640 Content-Type: application/json
641
642
643 {{/code}}
644
645 {{code language="http" title="**Response**"}}
646 HTTP/1.1 200 OK
647 Content-Type: application/json
648
649 {
650 "token": "954c8699-b38f-47a2-b568-668b8837dad8",
651 "PanTrunc": "85479*********648",
652 "deleted" : false,
653 "mainCard": true,
654 "cardHolder" : {
655 "number" : "123465",
656 "name": "test testsson",
657 "nationalConsumerIdentifier": {
658 "value": "19101010-1010",
659 "countryCode": "SE"
660 }
661 },
662 "@id": "/ledger/account/v1/XXX/accounts/NNN/cards/954c8699-b38f-47a2-b568-668b8837dad8",
663 "parentHREF": "/ledger/account/v1/XXX/accounts/NNN",
664 "operation" : [
665 {
666 "rel" : "partial-update",
667 "method" : "patch",
668 "href" : "/ledger/account/v1/XXX/accounts/NNN/cards/954c8699-b38f-47a2-b568-668b8837dad8"
669 },
670 {
671 "rel": "add-replacement-card",
672 "href": "/ledger/account/v1/XXX/accounts/NNN/cards/5823a2d9-34d2-4bc4-8b6d-1e27f4511363/add-replacement-card",
673 "method": "POST"
674 }
675 ]
676 }
677 {{/code}}
678
679 ==== Card resource properties ====
680
681 (% class="table-bordered table-striped" %)
682 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 62px;" %)Modify (patch)|=(% style="width: 1401px;" %)Description
683 |(% style="width:337px" %)token|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:62px" %) |(% style="width:1401px" %)token identifier of the card
684 |(% style="width:337px" %)panTrunc|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:62px" %) |(% style="width:1401px" %)truncated PAN
685 |(% style="width:337px" %)deleted|(% style="width:205px" %)bool|(% style="width:208px" %) |(% style="background-color:palegreen; width:62px" %) |(% style="width:1401px" %)indicates wheter the card has been deleted
686 |(% style="width:337px" %)mainCard|(% style="width:205px" %)bool|(% style="width:208px" %) |(% style="width:62px" %) |(% style="width:1401px" %)indicated whether this card is the main card of the account (cardholder is always owner of account)
687 |(% style="width:337px" %)cardHolder.number|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:62px" %) |(% style="width:1401px" %)Cardholder customernumber
688 |(% style="width:337px" %)cardHolder.name|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:62px" %) |(% style="width:1401px" %)Cardholder fullname
689 |(% style="width:337px" %)cardHolder.nationalConsumerIdentifier.value|(% style="width:205px" %)string|(% style="width:208px" %)YYYYMMDD-NNNC|(% style="width:62px" %) |(% style="width:1401px" %)
690 |(% style="width:337px" %)cardHolder.nationalConsumerIdentifier.countryCode|(% style="width:205px" %)string|(% style="width:208px" %)[[ISO 3166-1 alpha-2>>url:https://sv.wikipedia.org/wiki/ISO_3166]]|(% style="width:62px" %) |(% style="width:1401px" %)
691
692 == Transactions ==
693
694 ==== List transactions on an account ====
695
696 You can filter transactions by date in two different ways. Either filtering can be done by date range or by listing transactions by month.
697
698 **Date range example**
699
700 {{code language="http" title="**Request**"}}
701 GET /ledger/account/v1/XXX/accounts/NNN/transactions?fromDate=2020-02-10&todate=2020-06-01 HTTP/1.1
702 Host: -
703 Authorization: Bearer <Token>
704 Content-Type: application/json
705
706
707 {{/code}}
708
709 **Monthly example**
710
711 {{code language="http" title="**Request**"}}
712 GET /ledger/account/v1/XXX/accounts/NNN/transactions?month=2020-04 HTTP/1.1
713 Host: -
714 Authorization: Bearer <Token>
715 Content-Type: application/json
716
717
718 {{/code}}
719
720 **Standard (default last 30 days) **
721
722 {{code language="http" title="**Request**"}}
723 GET /ledger/account/v1/XXX/accounts/NNN/transactions HTTP/1.1
724 Host: -
725 Authorization: Bearer <Token>
726 Content-Type: application/json
727
728
729 {{/code}}
730
731
732 {{code language="http" title="**Response**"}}
733 HTTP/1.1 200 OK
734 Content-Type: application/json
735
736 {
737 "operations": null,
738 "items": [
739 {
740 "type": "payment",
741 "description": "",
742 "amount": 200.00,
743 "initiatedFromPointOfSale": false,
744 "date": "2019-10-09"
745 },
746 {
747 "type": "purchase",
748 "description": "testbutiken, köpref. 12345689",
749 "amount": 200.00,
750 "initiatedFromPointOfSale": true,
751 "date": "2019-10-09"
752 },
753 {
754 "type": "credit",
755 "description": "",
756 "amount": 200.00,
757 "initiatedFromPointOfSale": true,
758 "date": "2019-10-09"
759 }
760 ],
761 "@id": "/ledger/account/v1/XXX/accounts/NNN/transactions"
762 }
763 {{/code}}
764
765 ==== Transaction resource properties ====
766
767 (% class="table-bordered table-striped" %)
768 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 621px;" %)Description
769 |(% style="width:337px" %)type|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:621px" %)(((
770 Type of transaction
771
772 * Payment
773 * Purchase
774 * Credit
775 * AdministrationFee
776 * BillingFee
777 * CollectionFee
778 * Deduction
779 * Disbursement
780 * DisbursementReturned
781 * Interest
782 * LateFee
783 * ReminderFee
784 * MigratedBalance// (Amount of the initially migrated balance on the account)//
785 )))
786 |(% style="width:337px" %)description|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:621px" %)Description of the transaction, for purchases it usually includes "point of sale" and "receipt reference"
787 |(% style="width:337px" %)amount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:621px" %)This value can be either positive or negative. Negative means decreasing debt or increasing surplus. Positive transactions increases debt or decreases surplus.
788 |(% style="width:337px" %)initiatedFromPointOfSale|(% style="width:205px" %)bool|(% style="width:208px" %) |(% style="width:621px" %)Indicates whether the transaction was initiated from point of sale, or else it is a "ledger" transaction that was initiated internally in the ledgersystem.
789 |(% style="width:337px" %)date|(% style="width:205px" %)date|(% style="width:208px" %) |(% style="width:621px" %)Date when the transaction was initiated (Authorization date)
790
791 == Reservations ==
792
793 ==== List reservations in an account ====
794
795 {{code language="http" title="**Request**"}}
796 GET /ledger/account/v1/XXX/accounts/NNN/reservations HTTP/1.1
797 Host: -
798 Authorization: Bearer <Token>
799 Content-Type: application/json
800
801
802 {{/code}}
803
804
805 {{code language="http" title="**Response**"}}
806 HTTP/1.1 201 Created
807 Content-Type: application/json
808
809 {
810 "operations": null,
811 "items": [
812 {
813 "amount": 200.00,
814 "description" : "",
815 "date": "2019-10-05",
816 },
817 {
818 "amount": 450.00,
819 "description" : "",
820 "date": "2019-10-02",
821 },
822 ],
823 "@id": "/ledger/account/v1/XXX/accounts/NNN/reservations",
824 }
825 {{/code}}
826
827 ==== Reservation resource properties ====
828
829 (% class="table-bordered table-striped" %)
830 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 621px;" %)Description
831 |(% style="width:337px" %)amount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:621px" %)
832 |(% style="width:337px" %)description|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:621px" %)Description of the reservation, normally "point of sale".
833 |(% style="width:337px" %)date|(% style="width:205px" %)date|(% style="width:208px" %) |(% style="width:621px" %)Date when the reservation occured
834
835 == Recurring-payment-configuration ==
836
837 (% class="wikigeneratedid" %)
838 This resource contain information/settings related to how recurring payments should behave on this account.
839
840 ====
841 Get settings on an account ====
842
843
844 {{code language="http" title="**Request**"}}
845 GET /ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration/ HTTP/1.1
846 Host: -
847 Authorization: Bearer <Token>
848 Content-Type: application/json
849 {{/code}}
850
851
852 {{code language="http" title="**Response**"}}
853 HTTP/1.1 200 OK
854 Content-Type: application/json
855
856 {
857 "@id" : "/ledger/account/v1/XXX/accounts/NNN/recurring-payment-configurations",
858 "paymentMethod" : "autogiro",
859 "paymentScope" : "fixedRecurring",
860 "fixedAmount" : 1500.00,
861 "parentHREF": "/ledger/account/v1/XXX/accounts/NNN",
862 "operation" : [
863 {
864 "rel" : "partially-update-recurring-payment-consent",
865 "method" : "patch",
866 "href" : "/ledger/account/v1/XXX/accounts/NNN/recurring-payment-consent"
867 }
868 ]
869 }
870 {{/code}}
871
872 ==== Create settings on an account ====
873
874 (% class="wikigeneratedid" %)
875 Execute http **POST **towards this resource to create recurring payments configuration for specified account.
876
877 {{code language="http" title="**Request**"}}
878 POST /ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration HTTP/1.1
879 Host: -
880 Authorization: Bearer <Token>
881 Content-Type: application/json
882
883 {
884 "paymentMethod" : "autogiro",
885 "paymentScope" : "billedAmount",
886 "fixedAmount" : 0.00
887 }
888 {{/code}}
889
890 ====
891 Update settings on an account ====
892
893 (% class="wikigeneratedid" %)
894 Execute http **PATCH** towards this resource to update the recurring payment configuration
895
896 {{code language="http" title="**Request**"}}
897 PATCH /ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration HTTP/1.1
898 Host: -
899 Authorization: Bearer <Token>
900 Content-Type: application/json
901
902 {
903 "paymentScope" : "billedAmount",
904 "fixedAmount" : 0.00
905 }
906 {{/code}}
907
908 ==== Delete settings on an account ====
909
910 (% class="wikigeneratedid" %)
911 Execute http **DELETE **to delete the recurring payment settings for the specified account. By deleting the settings, the account will not use the consent registered on the customer for recurring payments.
912
913 {{code language="http" title="**Request**"}}
914 DELETE /ledger/account/v1/XXX/accounts/NNN/recurring-payment-configuration HTTP/1.1
915 Host: -
916 Authorization: Bearer <Token>
917 Content-Type: application/json
918
919 {}
920 {{/code}}
921
922 ==== Recurring-payment-configuration resource properties ====
923
924 (% class="table-bordered table-striped" %)
925 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 58px;" %)Modify (patch)|=(% style="width: 1176px;" %)Description
926 |(% style="width:337px" %)paymentMethod|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="background-color:palegreen; width:58px" %) |(% style="width:1176px" %)paymentMethods:(((
927 * autogiro
928 )))
929 |(% style="width:337px" %)paymentScope|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="background-color:palegreen; width:58px" %) |(% style="width:1176px" %)(((
930 paymentScopes:
931
932 * fixedRecurring (Fixed amount to debit monthly)
933 * totalDebt (Total account debt / used credit will be debited each month)
934 * billedAmount (Only the //"minimum amount to pay"// will be debited each month)
935 )))
936 |(% style="width:337px" %)fixedAmount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="background-color:palegreen; width:58px" %) |(% style="width:1176px" %)amount to monthly debit end-customers bankaccount (Only valid if recurringPaymentScope is set to "fixedRecurring")
937
938 == Active-payment-orders ==
939
940 (% class="wikigeneratedid" %)
941 This resource corresponds to an active / scheduled payment order placed against the specific account, the end-customer will be debited at the given executeDate.
942
943 ====
944 Get active payment orders for an account ====
945
946
947 {{code language="http" title="**Request**"}}
948 GET /ledger/account/v1/XXX/accounts/NNN/active-payment-orders/ HTTP/1.1
949 Host: -
950 Authorization: Bearer <Token>
951 Content-Type: application/json
952 {{/code}}
953
954
955 {{code language="http" title="**Response**"}}
956 HTTP/1.1 200 OK
957 Content-Type: application/json
958
959 {
960 "operations": null,
961 "items": [
962 {
963 "paymentMethod": "autogiro",
964 "executeDate": "2020-02-15",
965 "amount": 200.00
966 }
967 ],
968 "view": {
969 "@id": "/ledger/account/v1/XXX/accounts/NNN/active-payment-orders?$top=2&$skip=0",
970 "next": "/ledger/account/v1/XXX/accounts/NNN/active-payment-orders?$top=2&$skip=2"
971 }
972 }
973 {{/code}}
974
975 ==== ====
976
977 ==== Active-payment-orders resource properties ====
978
979 (% class="table-bordered table-striped" %)
980 |=(% style="width: 337px;" %)Property|=(% style="width: 205px;" %)Data type|=(% style="width: 208px;" %)Format|=(% style="width: 58px;" %)Modify (patch)|=(% style="width: 1176px;" %)Description
981 |(% style="width:337px" %)paymentMethod|(% style="width:205px" %)string|(% style="width:208px" %) |(% style="width:58px" %) |(% style="width:1176px" %)paymentMethods:(((
982 * autogiro
983 )))
984 |(% style="width:337px" %)executeDate|(% style="width:205px" %)Date|(% style="width:208px" %) |(% style="width:58px" %) |(% style="width:1176px" %)(((
985 The date when the payment order will be executed
986 )))
987 |(% style="width:337px" %)amount|(% style="width:205px" %)decimal|(% style="width:208px" %) |(% style="width:58px" %) |(% style="width:1176px" %)The amount to debit the owner of the consent
988
989 === ===
990
991 {{display reference="developer:Main.Invoicing.ledger-api-general-docs.api-section-problems.WebHome"/}}
992
993 === Problem types ===
994
995 (% class="box infomessage" %)
996 (((
997 Note, each problem typecode is preceded by "ledger/account/v1/problems/" in this API, e.g. the error "validation" in the table below will appear as typecode "ledger/account/v1/problems/validation".
998 )))
999
1000 (% class="table-bordered table-striped" %)
1001 |=(% style="width: 537px;" %)Problem type (code)|=(% style="width: 172px;" %)Httpstatus|=(% style="width: 796px;" %)Description
1002 |(% 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
1003 |(% style="width:537px" %)forbidden|(% style="width:172px" %)403|(% style="width:796px" %)occurs if access to method is not allowed.
1004 |(% style="width:537px" %)customer-not-found|(% style="width:172px" %)404|(% style="width:796px" %)can occur if customernumber is part of the querystring towards account resource
1005 |(% style="width:537px" %)card-not-found|(% style="width:172px" %)404|(% style="width:796px" %)
1006 |(% style="width:537px" %)duplicate-card-token|(% style="width:172px" %)409|(% style="width:796px" %)
1007 |(% style="width:537px" %)card-update-failed|(% style="width:172px" %)422|(% style="width:796px" %)
1008 |(% style="width:537px" %)account-not-found|(% style="width:172px" %)404|(% style="width:796px" %)
1009 |(% style="width:537px" %)invalid-reg-no|(% style="width:172px" %)400|(% style="width:796px" %)