Wiki source code of ../credit-account

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