-
Notifications
You must be signed in to change notification settings - Fork 5
/
openapi.yaml
1664 lines (1637 loc) · 60.1 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: Klarna Payments API V1
description: >-
The payments API is used to create a session to offer Klarna's payment
methods as part of your checkout. As soon as the purchase is completed the
order should be read and handled using the [`Order Management
API`](https://docs.klarna.com/api/ordermanagement).
**Note:** Examples provided in this section includes full payloads,
including all supported fields , required and optionals. In order to
implement a best in class request we recommend you don't include customer
details when initiating a payment session. Refer to [Initiate a
payment](https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-1-initiate-a-payment/)
section for further details.
Read more on [Klarna payments](https://docs.klarna.com/klarna-payments/).
version: 1.0.0
x-document-metadata:
copyright: © 2005 - 2024 Klarna Bank AB (publ). All rights reserved.
trace-id: e99bf51-3849839-docs-portal-api-1708002180806
date-created: 2024-02-15T13:03:31+0000
x-konfig-ignore:
potential-incorrect-type: true
servers:
- url: https://api.klarna.com
tags:
- name: Payment
paths:
/payments/v1/sessions:
post:
tags:
- Payment
summary: Create a session
operationId: Payment_createSession
description: >-
Use this API call to create a Klarna Payments session.<br/>When a
session is created you will receive the available
`payment_method_categories` for the session, a `session_id` and a
`client_token`. The `session_id` can be used to read or update the
session using the REST API. The `client_token` should be passed to the
browser.
Read more on **[Create a new payment
session](https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-1-initiate-a-payment/)**.
requestBody:
description: session_request
content:
application/json:
schema:
$ref: '#/components/schemas/session_create'
required: true
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/merchant_session'
'400':
description: >-
We were unable to create a session with the provided data. Some
field constraint was violated.
'403':
description: You were not authorized to execute this operation.
/payments/v1/sessions/{session_id}:
post:
tags:
- Payment
summary: Update a session
operationId: Payment_updateSessionDetails
description: >-
Use this API call to update a Klarna Payments session with new details,
in case something in the order has changed and the checkout has been
reloaded. Including if the consumer adds a new item to the cart or if
consumer details are updated.
Read more on **[Update an existing payment
session](https://docs.klarna.com/klarna-payments/other-actions/update-the-cart/)**.
parameters:
- description: session_id
name: session_id
in: path
required: true
schema:
type: string
requestBody:
description: session_request
content:
application/json:
schema:
$ref: '#/components/schemas/session'
required: true
responses:
'204':
description: The session was updated successfully.
'400':
description: >-
We were unable to update the session with the provided data. Some
field constraint was violated.
'403':
description: You were not authorized to execute this operation.
'404':
description: The session does not exist.
get:
tags:
- Payment
summary: Get details about a session
operationId: Payment_getSessionDetails
description: >-
Use this API call to get a Klarna Payments session. You can read the
Klarna Payments session at any time after it has been created, to get
information about it. This will return all data that has been collected
during the session.
Read more on **[Read an existing payment
session](https://docs.klarna.com/klarna-payments/other-actions/check-the-details-of-a-payment-session/)**.
parameters:
- description: session_id
name: session_id
in: path
required: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/session_read'
'403':
description: You were not authorized to execute this operation.
'404':
description: The session does not exist.
/payments/v1/authorizations/{authorizationToken}:
delete:
tags:
- Payment
summary: Cancel an authorization
operationId: Payment_cancelAuthorization
description: >-
Use this API call to cancel/release an authorization. If the
`authorization_token` received during a Klarna Payments won’t be used to
place an order immediately you could release the authorization.
Read more on **[Cancel an existing
authorization](https://docs.klarna.com/klarna-payments/other-actions/cancel-an-authorization/)**.
parameters:
- name: authorizationToken
in: path
required: true
schema:
type: string
responses:
'204':
description: The authorization was cancelled successfully.
'403':
description: You were not authorized to execute this operation.
'404':
description: The authorization does not exist.
/payments/v1/authorizations/{authorizationToken}/order:
post:
tags:
- Payment
summary: Create an order
operationId: Payment_createOrder
description: >-
Use this API call to create a new order. Placing an order towards Klarna
means that the Klarna Payments session will be closed and that an order
will be created in Klarna's system.<br/>When you have received the
`authorization_token` for a successful authorization you can place the
order. Among the other order details in this request, you include a URL
to the confirmation page for the customer.<br/>When the Order has been
successfully placed at Klarna, you need to handle it either through the
Merchant Portal or using [Klarna’s Order Management
API](https://docs.klarna.com/api/payments/).
Read more on **[Create a new
order](https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-3-create-an-order/)**.
parameters:
- name: authorizationToken
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/create_order_request'
responses:
'200':
description: Order was successfully created.
content:
application/json:
schema:
$ref: '#/components/schemas/order'
'400':
description: >-
We were unable to create an order with the provided data. Some field
constraint was violated.
'403':
description: You were not authorized to execute this operation.
'404':
description: The authorization does not exist.
'409':
description: >-
The data in the request does not match the session for the
authorization.
/payments/v1/authorizations/{authorizationToken}/customer-token:
post:
tags:
- Payment
summary: Generate a consumer token
operationId: Payment_generateCustomerToken
description: >-
Use this API call to create a Klarna Customer Token.<br/>After having
obtained an `authorization_token` for a successful authorization, this
can be used to create a purchase token instead of placing the order.
Creating a Klarna Customer Token results in Klarna storing customer and
payment method details.
Read more on **[Generate a consumer
token](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-token/)**.
parameters:
- name: authorizationToken
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/customer_token_creation_request'
responses:
'200':
description: Token was successfully created.
content:
application/json:
schema:
$ref: '#/components/schemas/customer_token_creation_response'
'400':
description: >-
We were unable to create a customer token with the provided data.
Some field constraint was violated.
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorV2'
'403':
description: You were not authorized to execute this operation.
'404':
description: The authorization does not exist.
'409':
description: >-
The data in the request does not match the session for the
authorization.
components:
schemas:
ErrorV2:
type: object
properties:
correlation_id:
type: string
error_code:
type: string
error_messages:
type: array
items:
type: string
address:
type: object
properties:
title:
description: |-
Customer’s Title. Allowed values per country:
UK - "Mr", "Ms"
DE - "Herr", "Frau"
AT: "Herr, "Frau"
CH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme"
BE: "Dhr.", "Mevr."
NL: "Dhr.", "Mevr."
type: string
example: Mr.
minLength: 0
maxLength: 20
attention:
description: ‘Attn.’ (if applicable). Only applicable for B2B customers.
type: string
example: Attn
minLength: 0
maxLength: 99
city:
description: Customer’s city.
type: string
example: London
minLength: 0
maxLength: 99
country:
description: >-
Customer’s country. This value overrides the purchase country if
they are different. Should follow the standard of ISO 3166 alpha-2.
E.g. GB, US, DE, SE.
type: string
example: GB
pattern: ^[A-Za-z]{2,2}$
email:
description: Customer’s email address.
type: string
example: test.sam@test.com
minLength: 0
maxLength: 99
family_name:
description: >-
Customers family name in UTF-8 encoding.
Cannot be only numbers, must be more than 1 character.
Allowed special characters: -'’.
More information can be found [in this
link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)
type: string
example: Andersson
minLength: 0
maxLength: 99
given_name:
description: >-
Customers given name in UTF-8 encoding.
Cannot be only numbers, must be more than 1 character.
Allowed special characters: -'’.
More information can be found [in this
link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)
type: string
example: Adam
minLength: 0
maxLength: 99
organization_name:
description: >-
Organization name (if applicable). Only applicable for B2B
customers.
type: string
minLength: 0
maxLength: 99
phone:
description: Phone number. Preferably a mobile phone number.
type: string
example: '+44795465131'
minLength: 0
maxLength: 99
postal_code:
description: >-
Customer’s postal code. Validation according to Universal Postal
Union addressing systems.
E.g. 12345, W1G OPW.
type: string
example: W1G 0PW
minLength: 0
maxLength: 10
region:
description: >-
Customer’s region or state - Mandatory for US and AU market.
Validations according to ISO 3166-2 format, e.g. OH, NJ, etc.
type: string
example: OH
minLength: 0
maxLength: 99
street_address:
description: >-
Customer’s street address. Regional formatting is required, as
follows:
UK/US/FR: 33 Cavendish Square
Rest of EU: De Ruijterkade 7
type: string
example: 33 Cavendish Square
minLength: 0
maxLength: 99
street_address2:
description: 'Customer’s street address. Second Line. '
type: string
example: Floor 22 / Flat 2
minLength: 0
maxLength: 99
asset_urls:
type: object
properties:
descriptive:
description: >-
URL of the descriptive asset. Using this dynamic asset will make
sure that any copy update of Klarna will automatically be
propagated.
type: string
example: >-
https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg
standard:
description: >-
URL of the standard asset. Using this dynamic asset will make sure
that any copy update of Klarna will automatically be propagated.
type: string
example: >-
https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg
attachment:
type: object
required:
- body
- content_type
properties:
body:
description: >-
The content of the extra merchant data should be presented as a
string inside this property. The body should be an object containing
any of the keys and sub-objects described below serialized to JSON.
More information on that object can be found
[here](https://developers.klarna.com/api/#attachment-schema).
type: string
example: >-
{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}
content_type:
description: >-
The content type of the body. It is usually represented as
"application/vnd.klarna.internal.emd-v2+json"
type: string
example: application/vnd.klarna.internal.emd-v2+json
authorized_payment_method:
type: object
required:
- type
properties:
number_of_days:
type: integer
format: int32
number_of_installments:
type: integer
format: int32
type:
type: string
enum:
- invoice
- fixed_amount
- base_account
- direct_debit
- direct_bank_transfer
- b2b_invoice
- card
- slice_it_by_card
- pay_later_by_card
- pay_by_card
- fixed_sum_credit
- alternative_payment_method
create_order_request:
type: object
required:
- order_amount
- order_lines
- purchase_country
- purchase_currency
properties:
authorization_token:
description: Authorization token.
type: string
readOnly: true
auto_capture:
description: Allow merchant to trigger auto capturing.
type: boolean
default: false
billing_address:
$ref: '#/components/schemas/address'
custom_payment_method_ids:
description: >-
Promo codes - The array could be used to define which of the
configured payment options within a payment category (pay_later,
pay_over_time, etc.) should be shown for this purchase. Discuss with
the delivery manager to know about the promo codes that will be
configured for your account. The feature could also be used to
provide promotional offers to specific customers (eg: 0% financing).
Please be informed that the usage of this feature can have
commercial implications.
type: array
items:
type: string
customer:
$ref: '#/components/schemas/customer'
locale:
description: >-
Used to define the language and region of the customer. The locale
follows the format of [RFC
1766](https://datatracker.ietf.org/doc/rfc1766/), meaning its value
consists of language-country.
Read more on **[Supported Locals and
Currencies](https://docs.klarna.com/klarna-payments/in-depth-knowledge/puchase-countries-currencies-locales/)**.
type: string
example: en-GB
pattern: ^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$
merchant_data:
description: >-
Pass through field to send any information about the order to be
used later for reference while retrieving the order details (max
6000 characters)
type: string
example: >-
{"order_specific":[{"substore":"Women's
Fashion","product_name":"Women Sweatshirt"}]}
minLength: 0
maxLength: 6000
merchant_reference1:
description: >-
Used for storing merchant's internal order number or other
reference.
type: string
example: ON4711
minLength: 0
maxLength: 255
merchant_reference2:
description: >-
Used for storing merchant's internal order number or other
reference. The value is available in the settlement files. (max 255
characters).
type: string
example: hdt53h-zdgg6-hdaff2
minLength: 0
maxLength: 255
merchant_urls:
$ref: '#/components/schemas/merchant_urls'
order_amount:
description: >-
Total amount of the order including tax and any available discounts.
The value should be in non-negative minor units. Eg: 25 Euros should
be 2500.
type: integer
format: int64
example: 2000
minimum: 0
order_lines:
description: >-
The array containing list of line items that are part of this order.
Maximum of 1000 line items could be processed in a single order.
type: array
items:
$ref: '#/components/schemas/order_line'
maxItems: 1000
minItems: 1
order_tax_amount:
description: >-
Total tax amount of the order. The value should be in non-negative
minor units. Eg: 25 Euros should be 2500.
type: integer
format: int64
example: 333
minimum: 0
payment_method_categories:
description: Available payment method categories
type: array
readOnly: true
uniqueItems: true
items:
$ref: '#/components/schemas/payment_method_category'
purchase_country:
description: >-
The purchase country of the customer. The billing country always
overrides purchase country if the values are different. Formatted
according to ISO 3166 alpha-2 standard, e.g. GB, SE, DE, US, etc.
type: string
example: GB
pattern: ^[A-Za-z]{2,2}$
purchase_currency:
description: >-
The purchase currency of the order. Formatted according to ISO 4217
standard, e.g. USD, EUR, SEK, GBP, etc.
type: string
example: GBP
pattern: ^[A-Za-z]{3,3}$
shipping_address:
$ref: '#/components/schemas/address'
status:
description: >-
The current status of the session. Possible values: 'complete',
'incomplete' where 'complete' is set when the order has been placed.
type: string
example: complete
readOnly: true
enum:
- complete
- incomplete
customer:
type: object
properties:
title:
description: |-
Customer’s Title. Allowed values per country:
UK - "Mr", "Ms"
DE - "Herr", "Frau"
AT: "Herr, "Frau"
CH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme"
BE: "Dhr.", "Mevr."
NL: "Dhr.", "Mevr."
type: string
example: Mr.
date_of_birth:
description: Customer’s date of birth. The format is ‘yyyy-mm-dd’
type: string
example: '1978-12-31'
gender:
description: Customer’s gender - ‘male’ or ‘female’
type: string
example: male
last_four_ssn:
description: >-
Last four digits of the customer's social security number. This
value is available for US customers.
type: string
pattern: ^([0-9]{4}|[0-9]{9})$
national_identification_number:
description: >-
The customer's national identification number. This value is
available for EU customers utilizing national identification
numbers.
type: string
organization_entity_type:
description: Organization entity type. Only applicable for B2B customers.
type: string
enum:
- LIMITED_COMPANY
- PUBLIC_LIMITED_COMPANY
- ENTREPRENEURIAL_COMPANY
- LIMITED_PARTNERSHIP_LIMITED_COMPANY
- LIMITED_PARTNERSHIP
- GENERAL_PARTNERSHIP
- REGISTERED_SOLE_TRADER
- SOLE_TRADER
- CIVIL_LAW_PARTNERSHIP
- PUBLIC_INSTITUTION
- OTHER
organization_registration_id:
description: Organization registration id. Only applicable for B2B customers.
type: string
type:
description: >-
Type of customer in the session. If nothing is added, a B2C session
will be the default. If it is a b2b-session, you should enter
organization to trigger a B2B session.
type: string
example: organization
pattern: ^(person|organization)$
vat_id:
description: VAT ID. Only applicable for B2B customers.
type: string
customer_read:
type: object
properties:
title:
description: |-
Customer’s Title. Allowed values per country:
UK - "Mr", "Ms"
DE - "Herr", "Frau"
AT: "Herr, "Frau"
CH: de-CH: "Herr, "Frau" it-CH: "Sig.", "Sig.ra" fr-CH: "M", "Mme"
BE: "Dhr.", "Mevr."
NL: "Dhr.", "Mevr."
type: string
example: Mr.
date_of_birth:
description: Customer’s date of birth. The format is ‘yyyy-mm-dd’
type: string
example: '1978-12-31'
gender:
description: Customer’s gender - ‘male’ or ‘female’
type: string
example: male
organization_entity_type:
description: Organization entity type. Only applicable for B2B customers.
type: string
enum:
- LIMITED_COMPANY
- PUBLIC_LIMITED_COMPANY
- ENTREPRENEURIAL_COMPANY
- LIMITED_PARTNERSHIP_LIMITED_COMPANY
- LIMITED_PARTNERSHIP
- GENERAL_PARTNERSHIP
- REGISTERED_SOLE_TRADER
- SOLE_TRADER
- CIVIL_LAW_PARTNERSHIP
- PUBLIC_INSTITUTION
- OTHER
organization_registration_id:
description: Organization registration id. Only applicable for B2B customers.
type: string
type:
description: >-
Type of customer in the session. If nothing is added, a B2C session
will be the default. If it is a b2b-session, you should enter
organization to trigger a B2B session.
type: string
example: organization
vat_id:
description: VAT ID. Only applicable for B2B customers.
type: string
customer_read_create_token:
type: object
properties:
date_of_birth:
description: Customer’s date of birth. The format is ‘yyyy-mm-dd’
type: string
example: '1978-12-31'
gender:
description: Customer’s gender - ‘male’ or ‘female’
type: string
example: male
customer_token_creation_request:
type: object
required:
- description
- intended_use
- locale
- purchase_country
- purchase_currency
properties:
description:
description: Description of the purpose of the token.
type: string
minLength: 1
maxLength: 255
billing_address:
$ref: '#/components/schemas/address'
customer:
$ref: '#/components/schemas/customer'
intended_use:
description: Intended use for the token.
type: string
enum:
- SUBSCRIPTION
locale:
description: RFC 1766 customer's locale.
type: string
example: en-GB
pattern: ^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$
purchase_country:
description: ISO 3166 alpha-2 purchase country.
type: string
example: GB
pattern: ^[A-Za-z]{2,2}$
purchase_currency:
description: ISO 4217 purchase currency.
type: string
example: GBP
pattern: ^[A-Za-z]{3,3}$
customer_token_creation_response:
type: object
required:
- token_id
properties:
billing_address:
$ref: '#/components/schemas/address'
customer:
$ref: '#/components/schemas/customer_read_create_token'
payment_method_reference:
description: Used to connect customers with payment method when it is present.
type: string
example: 0b1d9815-165e-42e2-8867-35bc03789e00
redirect_url:
description: >-
URL to redirect the customer to after placing the order. This is a
Klarna URL where Klarna will place a cookie in the customer’s
browser (if redirected) and redirect the customer back to the
confirmation URL provided by the merchant. This is not a mandatory
step but a recommended one to improve the returning customer’s
experience.
type: string
example: >-
https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect
token_id:
description: >-
Generated customer token. This token will be used to create a new
order for the subscription using the Create a New order using token
API.
type: string
example: 0b1d9815-165e-42e2-8867-35bc03789e00
merchant_session:
type: object
required:
- client_token
- session_id
properties:
client_token:
description: >-
Client token to be passed to the JS client while initializing the JS
SDK in the next step.
type: string
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw
maxLength: 4096
minLength: 0
payment_method_categories:
description: Available payment method categories for this particular session
type: array
uniqueItems: true
items:
$ref: '#/components/schemas/payment_method_category'
session_id:
description: >-
ID of the created session. Please use this ID to share with Klarna
for identifying any issues during integration.
type: string
example: 0b1d9815-165e-42e2-8867-35bc03789e00
maxLength: 255
minLength: 0
merchant_urls:
type: object
properties:
confirmation:
description: >-
URL of the merchant confirmation page. The consumer will be
redirected back to the confirmation page if the consumer is sent to
the redirect URL after placing the order. Insert {session.id} and/or
{order.id} as placeholder to connect either of those IDs to the
URL(max 2000 characters).
type: string
example: https://www.example-url.com/confirmation
minLength: 0
maxLength: 2000
notification:
description: >-
URL for notifications on pending orders. Insert {session.id} and/or
{order.id} as placeholder to connect either of those IDs to the URL
(max 2000 characters).
type: string
example: https://www.example-url.com/notification
minLength: 0
maxLength: 2000
push:
description: >-
URL that will be requested when an order is completed. Should be
different than checkout and confirmation URLs. Insert {session.id}
and/or {order.id} as placeholder to connect either of those IDs to
the URL (max 2000 characters).
type: string
example: https://www.example-url.com/push
minLength: 0
maxLength: 2000
authorization:
description: >-
URL for receiving the authorization token when payment is completed.
Used for Authorization Callback.
example: https://www.example-url.com/authorization
maxLength: 2000
minLength: 0
type: string
options:
type: object
properties:
color_border:
description: >-
Color for the border of elements within the iFrame. Value should be
a CSS hex color, e.g. "#FF9900"
type: string
example: '#FF9900'
pattern: ^#[A-Fa-f0-9]{6}$
color_border_selected:
description: >-
Color for the border of elements within the iFrame when selected by
the customer. Value should be a CSS hex color, e.g. "#FF9900"
type: string
example: '#FF9900'
pattern: ^#[A-Fa-f0-9]{6}$
color_details:
description: >-
Color for the bullet points within the iFrame. Value should be a CSS
hex color, e.g. "#FF9900"
type: string
example: '#FF9900'
pattern: ^#[A-Fa-f0-9]{6}$
color_text:
description: >-
Color for the texts within the iFrame. Value should be a CSS hex
color, e.g. "#FF9900"
type: string
example: '#FF9900'
pattern: ^#[A-Fa-f0-9]{6}$
radius_border:
description: Radius for the border of elements within the iFrame.
type: string
example: 5px
order:
type: object
required:
- order_id
properties:
authorized_payment_method:
$ref: '#/components/schemas/authorized_payment_method'
fraud_status:
description: >-
Fraud status for the order. Either ACCEPTED or PENDING. If ACCEPTED,
the order could be captured. If PENDING, please wait till you
receive the notification from Klarna in the notification URL that
the order has been approved. You can find additional information
here.
type: string
order_id:
description: >-
Unique order ID of the transaction. This ID will be used for all
order management processes.
type: string
redirect_url:
description: >-
URL to redirect the customer to after placing the order. This is a
Klarna URL to which the merchant should redirect the customer to.
Klarna will place a cookie in the customer’s browser (if redirected)
and redirect the customer back to the confirmation URL provided by
the merchant. This is not a mandatory step but a recommended one to
improve the returning customer’s experience. It is a spontaneous
step and does not harm the customer’s experience.
type: string
example: >-
https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect
order_line:
type: object
required:
- name
- quantity
- total_amount
- unit_price
properties:
image_url:
description: >-
URL to an image that can be later embedded in communications between
Klarna and the customer. (max 1024 characters).
A minimum of 250x250 px resolution is recommended for the image to look good in the Klarna app, and below 50x50 px won't even show. We recommend using a good sized image (650x650 px or more), however the file size must not exceed 12MB.
type: string
example: https://www.exampleobjects.com/logo.png
minLength: 0
maxLength: 1024
merchant_data:
description: >-
Used for storing merchant's internal order number or other
reference. Pass through field. (max 1024 characters)
type: string
example: >-
{"customer_account_info":[{"unique_account_identifier":"test@gmail.com","account_registration_date":"2017-02-13T10:49:20Z","account_last_modified":"2019-03-13T11:45:27Z"}]}
minLength: 0
maxLength: 1024
name:
description: Descriptive name of the order line item.
type: string
example: Running shoe
minLength: 1
maxLength: 255
product_identifiers:
$ref: '#/components/schemas/product_identifiers'
product_url:
description: >-
URL to the product in the merchant’s webshop that can be later used
in communications between Klarna and the customer. (max 1024
characters)
type: string
example: https://.../AD6654412.html
minLength: 0
maxLength: 1024
quantity:
description: Quantity of the order line item. Must be a non-negative number.
type: integer
format: int64
example: 1
minimum: 0
quantity_unit:
description: >-
Unit used to describe the quantity, e.g. kg, pcs, etc. If defined
the value has to be 1-8 characters.
type: string
example: pcs
minLength: 1
maxLength: 8
reference:
description: >-
Client facing article number, SKU or similar. Max length is 256
characters.
type: string
example: AD6654412
minLength: 0
maxLength: 255
tax_rate:
description: >-
Tax rate of the order line. Non-negative value. The percentage value
is represented with two implicit decimals. I.e 2000 = 20%.
type: integer
format: int64
example: 2000
minimum: 0
maximum: 10000
total_amount:
description: >-
Total amount of the order line. Must be defined as minor units.