Wiki source code of bnpl-payment-order

Last modified by Mats Lyth on 2025/11/25 15:02
Show last authors
1 (% id="HChangelog" %)
2 = Changelog =
3
4
5 2024-10-30 - Init documenation
6 \\\\
7
8 (% id="HIntroduction" %)
9 = Introduction =
10
11
12 The bnpl-payment-order API handles payment flows for multiple buy-now-pay-later services, where the customer themselves are available to choose between preferred payment method from a set of preconfigured payment options.
13
14
15 [[image:1730445122347-474.png||height="435" width="467"]]
16
17 == 1. Bnpl-payment-orders ==
18
19
20 Get the specified payment order
21
22 ==== 1.1 Get specific Bnpl-payment-order ====
23
24 {{code language="http" title="**Request**"}}
25 GET /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders/{paymentOrderId} HTTP/1.1
26 Host: -
27 Authorization: Bearer<Token>
28 Content-Type: application/json
29
30 {{/code}}
31
32 Payment order that has been authorized and with full RemainingAmount left
33
34 {{code language="http" title="**Response**"}}
35 HTTP/1.1 200 OK
36 Content-Type: application/json
37
38 {
39 "paymentOrderId": 1234567890,
40 "status": "Authorized",
41 "authorizationAmount": 1000.00,
42 "remainingAmount": 1000.00,
43 "currency": "SEK",
44 "sellerAuthorizationId": "1234567890",
45 "customer": {
46 "nationalConsumerIdentifier": {
47 "value": "YYYYMMDD-XXXX",
48 "countryCode": "SE"
49 },
50 "email": "example@payex.com",
51 "msisdn": "\u002B46701234567"
52 },
53 "pointOfSale": "My Web Shop",
54 "mcc": "1234",
55 "restrictToProfiles": [
56 {
57 "profileName": "BA_PartPayment",
58 "subProfiles": [
59 {
60 "subProfileName": "InstallmentAccount_3"
61 }
62 ]
63 }
64 ],
65 "operations": [
66 {
67 "rel": "add-reversal",
68 "method": "POST",
69 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/reversals"
70 },
71 {
72 "rel": "redirect",
73 "method": "POST",
74 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/redirect"
75 },
76 {
77 "rel": "cancel-authorize",
78 "method": "POST",
79 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/cancel-authorize"
80 },
81 {
82 "rel": "add-capture",
83 "method": "POST",
84 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/captures"
85 },
86 {
87 "rel": "add-reversal",
88 "method": "POST",
89 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/reversals"
90 },
91 {
92 "rel": "redirect",
93 "method": "POST",
94 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/redirect"
95 },
96 {
97 "rel": "cancel-authorize",
98 "method": "POST",
99 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/cancel-authorize"
100 },
101 {
102 "rel": "add-capture",
103 "method": "POST",
104 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/captures"
105 }
106 ]
107 }
108 {{/code}}
109
110
111
112 **Possible problems**
113
114 (% class="table-bordered table-striped" %)
115 |=Http status |=Problem type |=Description
116 |400 |validation |occurs if any of the input validation fails, it is described in the problem which parameter that failed the validation
117 |404 |not-found |the targeted resource was not found, cause could be both that it's not accessible with provided information/credentials or that the resource doesn't exist
118 |500 |fatal |an unexpected error has occurred
119
120
121 ==== 1.2 Create Bnpl-payment-order ====
122
123 Create a payment order to begin authorization process
124
125 {{code language="http" title="**Request**"}}
126 POST /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders HTTP/1.1
127 Host: -
128 Authorization: Bearer<Token>
129 Content-Type: application/json
130
131 {
132 "authorizationAmount": 1000.00,
133 "currency": "SEK",
134 "sellerAuthorizationId": "1234567890",
135 "customer": {
136 "nationalConsumerIdentifier": {
137 "value": "YYYYMMDD-XXXX",
138 "countryCode": "SE"
139 },
140 "email": "example@payex.com",
141 "msisdn": "\u002B46701234567"
142 },
143 "pointOfSale": "My Web Shop",
144 "mcc": "1234",
145 "restrictToProfiles": [
146 {
147 "profileName": "BA_PartPayment",
148 "subProfiles": [
149 {
150 "subProfileName": "InstallmentAccount_3"
151 }
152 ]
153 }
154 ]
155 }
156 {{/code}}
157
158
159 **Request object specification**
160
161 (% class="table-bordered table-striped" %)
162 |=Property |=Data type|=Format|=Required|=Description
163 |authorizationAmount |number |Type: double
164 Max: 100000000
165 Min: 0 |Yes |The authorization amount, can't have more than 2 decimal places
166 |currency |string |(((
167 * SEK
168 * NOK
169 * DKK
170 * EUR
171 ))) |Yes |
172 |sellerAuthorizationId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |Yes |The seller's unique identifier of the authorize/payment order
173 |=customer |object | |Yes |
174 |= nationalConsumerIdentifier |object | |Yes |
175 | value |string | |Yes |The identifier - SSN, Personnummer, CPR, d-nummer, temporary identification number etc. Uniquely identifies the consumer. Visit developer.payex.com for information about supported national identifier format
176 | countryCode |string |Pattern: SE~|NO~|DK~|FI |Yes |The country code for the identifier value property. Valid values are 'SE', 'NO', 'DK', 'FI'. ~[~[ISO 3166-1 alpha-2>>url:https://sv.wikipedia.org/wiki/ISO_3166]]
177 | email |string |Pattern: ^~[^;\xA0\xD0\─@<>\p{Cc}]+@(?!\.)(?!.*\.\.)(?:~[^;\xA0\xD0\─@<>\p{Cc}]+\.~[^;\xA0\xD0\─@<>\p{Cc}]+~|\~[~[A-Fa-f\d\:]+\])(?<!\.)$ |Yes |Email to the customer
178 | msisdn |string |Pattern: ^~[+]{1}\d{4,14}$ |No |Phone number to the customer
179 |pointOfSale |string |Pattern: ^~[\u0020-\u003A \u003C-\u007E \u00A0-\u00FF \u2019]*$ |Yes |Trade name of the point of sale. Will be displayed to end customer.
180 |mcc |string | |Yes |Merchant Category Code
181 |=restrictToProfiles |array | |No |
182 | profileName |string | |Yes |Profile identifier
183 |= subProfiles |array | |No |
184 | subProfileName |string | |Yes |Sub profile identifier
185
186
187 Newly created payment order with restricted account profiles
188
189 {{code language="http" title="**Response**"}}
190 HTTP/1.1 201 Created
191 Content-Type: application/json
192
193 {
194 "paymentOrderId": 1234567890,
195 "status": "Created",
196 "authorizationAmount": 1000.00,
197 "remainingAmount": 0,
198 "currency": "SEK",
199 "sellerAuthorizationId": "1234567890",
200 "customer": {
201 "nationalConsumerIdentifier": {
202 "value": "YYYYMMDD-XXXX",
203 "countryCode": "SE"
204 },
205 "email": "example@payex.com",
206 "msisdn": "\u002B46701234567"
207 },
208 "pointOfSale": "My Web Shop",
209 "mcc": "1234",
210 "restrictToProfiles": [
211 {
212 "profileName": "BA_PartPayment",
213 "subProfiles": [
214 {
215 "subProfileName": "InstallmentAccount_3"
216 }
217 ]
218 }
219 ],
220 "operations": [
221 {
222 "rel": "add-reversal",
223 "method": "POST",
224 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/reversals"
225 },
226 {
227 "rel": "redirect",
228 "method": "POST",
229 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/redirect"
230 },
231 {
232 "rel": "cancel-authorize",
233 "method": "POST",
234 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/cancel-authorize"
235 },
236 {
237 "rel": "add-capture",
238 "method": "POST",
239 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/captures"
240 },
241 {
242 "rel": "add-reversal",
243 "method": "POST",
244 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/reversals"
245 },
246 {
247 "rel": "redirect",
248 "method": "POST",
249 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/redirect"
250 },
251 {
252 "rel": "cancel-authorize",
253 "method": "POST",
254 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/cancel-authorize"
255 },
256 {
257 "rel": "add-capture",
258 "method": "POST",
259 "href": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890/captures"
260 }
261 ],
262 "@id": "/ledger/bnpl-payment-order/v1/xxx/bnpl-payment-orders/1234567890"
263 }
264 {{/code}}
265
266
267 **Possible problems**
268
269 (% class="table-bordered table-striped" %)
270 |=Http status |=Problem type |=Description
271 |400 |validation |occurs if any of the input validation fails, it is described in the problem which parameter that failed the validation
272 |404 |not-found |the targeted resource was not found, cause could be both that it's not accessible with provided information/credentials or that the resource doesn't exist
273 |500 |fatal |an unexpected error has occurred
274
275
276
277 **Response object specification**
278
279 (% class="table-bordered table-striped" %)
280 |=Property |=Data type|=Format|=Description
281 |authorizationAmount |number |Type: double
282 Max: 100000000
283 Min: 0 |The authorization amount, can't have more than 2 decimal places
284 |currency |string |(((
285 * SEK
286 * NOK
287 * DKK
288 * EUR
289 ))) |
290 |sellerAuthorizationId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |The seller's unique identifier of the authorize/payment order
291 |=customer |object | |
292 |= nationalConsumerIdentifier |object | |
293 | value |string | |The identifier - SSN, Personnummer, CPR, d-nummer, temporary identification number etc. Uniquely identifies the consumer. Visit developer.payex.com for information about supported national identifier format
294 | countryCode |string |Pattern: SE~|NO~|DK~|FI |The country code for the identifier value property. Valid values are 'SE', 'NO', 'DK', 'FI'. ~[~[ISO 3166-1 alpha-2>>url:https://sv.wikipedia.org/wiki/ISO_3166]]
295 | email |string |Pattern: ^~[^;\xA0\xD0\─@<>\p{Cc}]+@(?!\.)(?!.*\.\.)(?:~[^;\xA0\xD0\─@<>\p{Cc}]+\.~[^;\xA0\xD0\─@<>\p{Cc}]+~|\~[~[A-Fa-f\d\:]+\])(?<!\.)$ |Email to the customer
296 | msisdn |string |Pattern: ^~[+]{1}\d{4,14}$ |Phone number to the customer
297 |pointOfSale |string |Pattern: ^~[\u0020-\u003A \u003C-\u007E \u00A0-\u00FF \u2019]*$ |Trade name of the point of sale. Will be displayed to end customer.
298 |mcc |string | |Merchant Category Code
299 |=restrictToProfiles |array | |
300 | profileName |string | |Profile identifier
301 |= subProfiles |array | |
302 | subProfileName |string | |Sub profile identifier
303 |paymentOrderId |number |Type: int64 |PaymentOrderId aka ExternalReservationId
304 |status |string |(((
305 * Created
306 * Rejected
307 * Canceled
308 * Failed
309 * Authorized
310 ))) |
311 |remainingAmount |number |Type: double
312 Max: 100000000
313 Min: 0 |Remaining amount of the authorize. If amount is zero then the authorize has already been fully used, cancelled or the payment order has not been authorized yet
314 |operations |array | |List of operations that is possible to perform on the current resource, read more about the ~[~[hypermedia part of the response>>https://developer.payex.com/xwiki/wiki/developer/view/Main/Invoicing/ledger-api-general-docs/restful-pattern-guideline/#HHyper-mediaresponse]]
315 |@id |string | |Uri identifier of the current resource
316 == 2. Cancel-authorize ==
317
318
319 ==== 2.1 Create Cancel-authorize ====
320
321 This operation is for removing any remaining amount of an already completed authorization. Already captured amount is unaffected.
322
323 {{code language="http" title="**Request**"}}
324 POST /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders/{paymentOrderId}/cancel-authorize HTTP/1.1
325 Host: -
326 Authorization: Bearer<Token>
327 Content-Type: application/json
328
329 {
330 }
331 {{/code}}
332
333
334
335 {{code language="http" title="**Response**"}}
336 HTTP/1.1 204 NO CONTENT
337 Content-Type: application/json
338
339 {}
340 {{/code}}
341
342
343 **Possible problems**
344
345 (% class="table-bordered table-striped" %)
346 |=Http status |=Problem type |=Description
347 |404 |not-found |the targeted resource was not found, cause could be both that it's not accessible with provided information/credentials or that the resource doesn't exist
348 |500 |fatal |an unexpected error has occurred
349
350
351 == 3. Captures ==
352
353
354 ==== 3.1 Create Capture ====
355
356 Perform a capture to solidify the purchase for this payment order. Multiple captures can be done for one payment order as long as we have RemainingAmount left on the order.
357
358 {{code language="http" title="**Request**"}}
359 POST /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders/{paymentOrderId}/captures HTTP/1.1
360 Host: -
361 Authorization: Bearer<Token>
362 Content-Type: application/json
363
364 {
365 "amount": 1000.00,
366 "currency": "SEK",
367 "orderLines": [
368 {
369 "itemDescription": "Phone",
370 "amount": 1000.00
371 }
372 ],
373 "sellerTransactionId": "1234567",
374 "receiptReference": "Example-receipt-Phone"
375 }
376 {{/code}}
377
378
379 **Request object specification**
380
381 (% class="table-bordered table-striped" %)
382 |=Property |=Data type|=Format|=Required|=Description
383 |amount |number |Type: double
384 Max: 100000000
385 Min: 0 |Yes |The total amount
386 |currency |string |(((
387 * SEK
388 * NOK
389 * DKK
390 * EUR
391 ))) |Yes |
392 |=orderLines |array | |Yes |
393 | itemDescription |string |Pattern: ^~[\u0020-\u003A \u003C-\u007E \u00A0-\u00FF \u2019]*$ |Yes |Name or description of an individual item in the capture
394 | amount |number |Type: double
395 Max: 100000000
396 Min: 0 |Yes |Price of an individual item in the capture
397 |sellerTransactionId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |Yes |The seller's unique identifier of the capture
398 |receiptReference |string |Pattern: ^~[a-zA-Z0-9#_:@.\-]{1,}$ |Yes |A receipt reference meaningful for the consumer
399
400
401 Capture example with one item in the order line
402
403 {{code language="http" title="**Response**"}}
404 HTTP/1.1 201 Created
405 Content-Type: application/json
406
407 {
408 "captureId": 1234,
409 "amount": 1000.00,
410 "currency": "SEK",
411 "orderLines": [
412 {
413 "itemDescription": "Phone",
414 "amount": 1000.00
415 }
416 ],
417 "sellerTransactionId": "Example-seller-123",
418 "receiptReference": "1234567",
419 "@id": "https://example.com/capture/1234"
420 }
421 {{/code}}
422
423
424 **Possible problems**
425
426 (% class="table-bordered table-striped" %)
427 |=Http status |=Problem type |=Description
428 |400 |validation |occurs if any of the input validation fails, it is described in the problem which parameter that failed the validation
429 |404 |not-found |the targeted resource was not found, cause could be both that it's not accessible with provided information/credentials or that the resource doesn't exist
430 |409 |currency-not-supported |Currency for this capture is invalid for this payment order, make sure it match with currency specified at order creation
431 |422 |corrupt-resource |Performed action may or may not have been completed but result was corrupted or incomplete. Read details for more information.
432 |500 |fatal |an unexpected error has occurred
433
434
435
436 **Response object specification**
437
438 (% class="table-bordered table-striped" %)
439 |=Property |=Data type|=Format|=Description
440 |amount |number |Type: double
441 Max: 100000000
442 Min: 0 |The total amount
443 |currency |string |(((
444 * SEK
445 * NOK
446 * DKK
447 * EUR
448 ))) |
449 |=orderLines |array | |
450 | itemDescription |string |Pattern: ^~[\u0020-\u003A \u003C-\u007E \u00A0-\u00FF \u2019]*$ |Name or description of an individual item in the capture
451 | amount |number |Type: double
452 Max: 100000000
453 Min: 0 |Price of an individual item in the capture
454 |sellerTransactionId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |The seller's unique identifier of the capture
455 |receiptReference |string |Pattern: ^~[a-zA-Z0-9#_:@.\-]{1,}$ |A receipt reference meaningful for the consumer
456 |captureId |number |Type: int64
457 Pattern: ^~[a-zA-Z0-9\-]{1,}$ |Identifier of the capture
458 |@id |string | |Uri identifier of the current resource
459 == 4. Reversals ==
460
461
462 ==== 4.1 Create Reversal ====
463
464 Can only reverse captures from this payment order
465
466 {{code language="http" title="**Request**"}}
467 POST /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders/{paymentOrderId}/reversals HTTP/1.1
468 Host: -
469 Authorization: Bearer<Token>
470 Content-Type: application/json
471
472 {
473 "amount": 1000.00,
474 "currency": "SEK",
475 "sellerTransactionId": "123"
476 }
477 {{/code}}
478
479
480 **Request object specification**
481
482 (% class="table-bordered table-striped" %)
483 |=Property |=Data type|=Format|=Required|=Description
484 |amount |number |Type: double
485 Max: 100000000
486 Min: 0 |Yes |The total amount to reverse
487 |currency |string |(((
488 * SEK
489 * NOK
490 * DKK
491 * EUR
492 ))) |Yes |
493 |sellerTransactionId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |Yes |The sellers unique identifier of the reversal
494
495
496 Reversal of 1000SEK
497
498 {{code language="http" title="**Response**"}}
499 HTTP/1.1 201 Created
500 Content-Type: application/json
501
502 {
503 "reversalId": "12345678",
504 "amount": 1000.00,
505 "currency": "SEK",
506 "sellerTransactionId": "123455679"
507 }
508 {{/code}}
509
510
511 **Possible problems**
512
513 (% class="table-bordered table-striped" %)
514 |=Http status |=Problem type |=Description
515 |400 |validation |occurs if any of the input validation fails, it is described in the problem which parameter that failed the validation
516 |404 |not-found |the targeted resource was not found, cause could be both that it's not accessible with provided information/credentials or that the resource doesn't exist
517 |500 |fatal |an unexpected error has occurred
518
519
520
521 **Response object specification**
522
523 (% class="table-bordered table-striped" %)
524 |=Property |=Data type|=Format|=Description
525 |amount |number |Type: double
526 Max: 100000000
527 Min: 0 |The total amount to reverse
528 |currency |string |(((
529 * SEK
530 * NOK
531 * DKK
532 * EUR
533 ))) |
534 |sellerTransactionId |string |Pattern: ^~[a-zA-Z0-9#_:@.\-åäöÅÄÖ]{1,}$ |The sellers unique identifier of the reversal
535 |reversalId |string | |Identifier of the reversal
536 |@id |string | |Uri identifier of the current resource
537 == 5. Redirect ==
538
539
540 ==== 5.1 Create Redirect ====
541
542 While payee is progressing the authorization implementor should start poll the parent resource BnplPaymentOrder for updates
543
544 {{code language="http" title="**Request**"}}
545 POST /ledger/bnpl-payment-order/v1/{ownerNo}/bnpl-payment-orders/{paymentOrderId}/redirect HTTP/1.1
546 Host: -
547 Authorization: Bearer<Token>
548 Content-Type: application/json
549
550 {
551 "returnUrl": "https://www.back-to-my-web-shop.com",
552 "redirectOptions": {
553 "languageCode": "SV"
554 }
555 }
556 {{/code}}
557
558
559 **Request object specification**
560
561 (% class="table-bordered table-striped" %)
562 |=Property |=Data type|=Format|=Required|=Description
563 |returnUrl |string | |Yes |Url to return the end user to after process is completed or cancelled
564 |=redirectOptions |object | |Yes |
565 | languageCode |string |(((
566 * EN
567 * SV
568 * NO
569 * DA
570 ))) |Yes |
571
572
573 Example response containing redirect info for the chosen payment method
574
575 {{code language="http" title="**Response**"}}
576 HTTP/1.1 200 OK
577 Content-Type: application/json
578
579 {
580 "redirectUrl": "https://www.open-chosen-payment-method-example.com"
581 }
582 {{/code}}
583
584
585 **Possible problems**
586
587 (% class="table-bordered table-striped" %)
588 |=Http status |=Problem type |=Description
589 |400 |validation |occurs if any of the input validation fails, it is described in the problem which parameter that failed the validation
590 |409 |invalid-state |Invalid state of payment order for redirect
591
592
593
594 **Response object specification**
595
596 (% class="table-bordered table-striped" %)
597 |=Property |=Data type|=Format|=Description
598 |redirectUrl |string | |Url to redirect the end user to
599
600
601 {{display reference="developer:Main.Invoicing.ledger-api-general-docs.api-section-problems.WebHome"/}}