generated from saleor/saleor-app-payment-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
klarna-payments.json
1513 lines (1513 loc) · 65.2 KB
/
klarna-payments.json
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": {
"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).\n\nRead more on [Klarna payments](https://docs.klarna.com/klarna-payments/).",
"version": "1.0.0",
"title": "Klarna Payments API V1",
"x-document-metadata": {
"copyright": "© 2005 - 2023 Klarna Bank AB (publ). All rights reserved.",
"trace-id": "d4bc4f8-5cd67bd-docs-portal-api-1692015301175",
"date-created": "2023-08-14T12:15:34+0000"
}
},
"tags": [
{
"name": "orders"
},
{
"name": "sessions"
}
],
"paths": {
"/payments/v1/authorizations/{authorizationToken}": {
"delete": {
"tags": ["orders"],
"summary": "Cancel an existing authorization",
"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.\nRead more on **[Cancel an existing authorization](https://docs.klarna.com/klarna-payments/other-actions/cancel-an-authorization/)**.",
"operationId": "cancelAuthorization",
"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}/customer-token": {
"post": {
"tags": ["orders"],
"summary": "Generate a consumer token",
"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.\nRead more on **[Generate a consumer token](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-token/)**.",
"operationId": "purchaseToken",
"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."
}
}
}
},
"/payments/v1/authorizations/{authorizationToken}/order": {
"post": {
"tags": ["orders"],
"summary": "Create a new order",
"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](#order-management-api).\nRead more on **[Create a new order](https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-3-create-an-order/)**.",
"operationId": "createOrder",
"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/sessions": {
"post": {
"tags": ["sessions"],
"summary": "Create a new payment session",
"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.\nRead more on **[Create a new payment session](https://docs.klarna.com/klarna-payments/integrate-with-klarna-payments/step-1-initiate-a-payment/)**.",
"operationId": "createCreditSession",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/session_create"
}
}
},
"description": "session_request",
"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}": {
"get": {
"tags": ["sessions"],
"summary": "Read an existing payment session",
"description": "Use this API call to read 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.\nRead more on **[Read an existing payment session](https://docs.klarna.com/klarna-payments/other-actions/check-the-details-of-a-payment-session/)**.",
"operationId": "readCreditSession",
"parameters": [
{
"name": "session_id",
"in": "path",
"description": "session_id",
"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."
}
}
},
"post": {
"tags": ["sessions"],
"summary": "Update an existing payment session",
"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.\nRead more on **[Update an existing payment session](https://docs.klarna.com/klarna-payments/other-actions/update-the-cart/)**.",
"operationId": "updateCreditSession",
"parameters": [
{
"name": "session_id",
"in": "path",
"description": "session_id",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/session"
}
}
},
"description": "session_request",
"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."
}
}
}
}
},
"externalDocs": {
"description": "Find out more about the Klarna REST APIs",
"url": "https://docs.klarna.com/api"
},
"servers": [
{
"url": "https://api.klarna.com"
}
],
"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": {
"attention": {
"type": "string",
"example": "Attn",
"description": "‘Attn.’ (if applicable). Only applicable for B2B customers.",
"minLength": 0,
"maxLength": 99
},
"city": {
"type": "string",
"example": "London",
"description": "Customer’s city.",
"minLength": 0,
"maxLength": 99
},
"country": {
"type": "string",
"example": "GB",
"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.",
"pattern": "^[A-Za-z]{2,2}$"
},
"email": {
"type": "string",
"example": "test.sam@test.com",
"description": "Customer’s email address.",
"minLength": 0,
"maxLength": 99
},
"family_name": {
"type": "string",
"example": "Andersson",
"description": "Customers family name in UTF-8 encoding.\nCannot be only numbers, must be more than 1 character.\nAllowed special characters: -'’.\nMore information can be found [in this link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)",
"minLength": 0,
"maxLength": 99
},
"given_name": {
"type": "string",
"example": "Adam",
"description": "Customers given name in UTF-8 encoding.\nCannot be only numbers, must be more than 1 character.\nAllowed special characters: -'’.\nMore information can be found [in this link](https://docs.klarna.com/klarna-payments/in-depth-knowledge/customer-data-requirements/#details-needed-per-market)",
"minLength": 0,
"maxLength": 99
},
"organization_name": {
"type": "string",
"description": "Organization name (if applicable). Only applicable for B2B customers.",
"minLength": 0,
"maxLength": 99
},
"phone": {
"type": "string",
"example": "+44795465131",
"description": "Phone number. Preferably a mobile phone number.",
"minLength": 0,
"maxLength": 99
},
"postal_code": {
"type": "string",
"example": "W1G 0PW",
"description": "Customer’s postal code. Validation according to Universal Postal Union addressing systems.\nE.g. 12345, W1G OPW.",
"minLength": 0,
"maxLength": 10
},
"region": {
"type": "string",
"example": "OH",
"description": "Customer’s region or state - Mandatory for US and AU market. Validations according to ISO 3166-2 format, e.g. OH, NJ, etc.",
"minLength": 0,
"maxLength": 99
},
"street_address": {
"type": "string",
"example": "33 Cavendish Square",
"description": "Customer’s street address. Regional formatting is required, as follows:\nUK/US/FR: 33 Cavendish Square\nRest of EU: De Ruijterkade 7",
"minLength": 0,
"maxLength": 99
},
"street_address2": {
"type": "string",
"example": "Floor 22 / Flat 2",
"description": "Customer’s street address. Second Line. ",
"minLength": 0,
"maxLength": 99
},
"title": {
"type": "string",
"example": "Mr.",
"description": "Customer’s Title. Allowed values per country:\nUK - \"Mr\", \"Ms\"\nDE - \"Herr\", \"Frau\"\nAT: \"Herr, \"Frau\"\nCH: de-CH: \"Herr, \"Frau\" it-CH: \"Sig.\", \"Sig.ra\" fr-CH: \"M\", \"Mme\" \nBE: \"Dhr.\", \"Mevr.\"\nNL: \"Dhr.\", \"Mevr.\"",
"minLength": 0,
"maxLength": 20
}
}
},
"asset_urls": {
"type": "object",
"properties": {
"descriptive": {
"type": "string",
"example": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
"description": "URL of the descriptive asset. Using this dynamic asset will make sure that any copy update of Klarna will automatically be propagated."
},
"standard": {
"type": "string",
"example": "https://x.klarnacdn.net/payment-method/assets/badges/generic/klarna.svg",
"description": "URL of the standard asset. Using this dynamic asset will make sure that any copy update of Klarna will automatically be propagated."
}
}
},
"attachment": {
"type": "object",
"required": ["body", "content_type"],
"properties": {
"body": {
"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\"}]}",
"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)."
},
"content_type": {
"type": "string",
"example": "application/vnd.klarna.internal.emd-v2+json",
"description": "The content type of the body. It is usually represented as \"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": {
"type": "string",
"description": "Authorization token.",
"readOnly": true
},
"auto_capture": {
"type": "boolean",
"description": "Allow merchant to trigger auto capturing.",
"default": false
},
"billing_address": {
"$ref": "#/components/schemas/address"
},
"custom_payment_method_ids": {
"type": "array",
"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. ",
"items": {
"type": "string"
}
},
"customer": {
"$ref": "#/components/schemas/customer"
},
"locale": {
"type": "string",
"example": "en-GB",
"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.\nRead more on **[Supported Locals and Currencies](https://docs.klarna.com/klarna-payments/in-depth-knowledge/puchase-countries-currencies-locales/)**.",
"pattern": "^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$"
},
"merchant_data": {
"type": "string",
"example": "{\"order_specific\":[{\"substore\":\"Women's Fashion\",\"product_name\":\"Women Sweatshirt\"}]}",
"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)",
"minLength": 0,
"maxLength": 6000
},
"merchant_reference1": {
"type": "string",
"example": "ON4711",
"description": "Used for storing merchant's internal order number or other reference.",
"minLength": 0,
"maxLength": 255
},
"merchant_reference2": {
"type": "string",
"example": "hdt53h-zdgg6-hdaff2",
"description": "Used for storing merchant's internal order number or other reference. The value is available in the settlement files. (max 255 characters).",
"minLength": 0,
"maxLength": 255
},
"merchant_urls": {
"$ref": "#/components/schemas/merchant_urls"
},
"order_amount": {
"type": "integer",
"format": "int64",
"example": 2000,
"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.",
"minimum": 0
},
"order_lines": {
"type": "array",
"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.",
"items": {
"$ref": "#/components/schemas/order_line"
},
"maxItems": 1000,
"minItems": 1
},
"order_tax_amount": {
"type": "integer",
"format": "int64",
"example": 333,
"description": "Total tax amount of the order. The value should be in non-negative minor units. Eg: 25 Euros should be 2500.",
"minimum": 0
},
"payment_method_categories": {
"type": "array",
"description": "Available payment method categories",
"readOnly": true,
"uniqueItems": true,
"items": {
"$ref": "#/components/schemas/payment_method_category"
}
},
"purchase_country": {
"type": "string",
"example": "GB",
"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.",
"pattern": "^[A-Za-z]{2,2}$"
},
"purchase_currency": {
"type": "string",
"example": "GBP",
"description": "The purchase currency of the order. Formatted according to ISO 4217 standard, e.g. USD, EUR, SEK, GBP, etc.",
"pattern": "^[A-Za-z]{3,3}$"
},
"shipping_address": {
"$ref": "#/components/schemas/address"
},
"status": {
"type": "string",
"example": "complete",
"description": "The current status of the session. Possible values: 'complete', 'incomplete' where 'complete' is set when the order has been placed.",
"readOnly": true,
"enum": ["complete", "incomplete"]
}
}
},
"customer": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string",
"example": "1978-12-31",
"description": "Customer’s date of birth. The format is ‘yyyy-mm-dd’"
},
"gender": {
"type": "string",
"example": "male",
"description": "Customer’s gender - ‘male’ or ‘female’"
},
"last_four_ssn": {
"type": "string",
"description": "Last four digits of the customer's social security number. This value is available for US customers.",
"pattern": "^([0-9]{4}|[0-9]{9})$"
},
"national_identification_number": {
"type": "string",
"description": "The customer's national identification number. This value is available for EU customers utilizing national identification numbers."
},
"organization_entity_type": {
"type": "string",
"description": "Organization entity type. Only applicable for B2B customers.",
"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": {
"type": "string",
"description": "Organization registration id. Only applicable for B2B customers."
},
"title": {
"type": "string",
"example": "Mr.",
"description": "Customer’s Title. Allowed values per country:\nUK - \"Mr\", \"Ms\"\nDE - \"Herr\", \"Frau\"\nAT: \"Herr, \"Frau\"\nCH: de-CH: \"Herr, \"Frau\" it-CH: \"Sig.\", \"Sig.ra\" fr-CH: \"M\", \"Mme\" \nBE: \"Dhr.\", \"Mevr.\"\nNL: \"Dhr.\", \"Mevr.\""
},
"type": {
"type": "string",
"example": "organization",
"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.",
"pattern": "^(person|organization)$"
},
"vat_id": {
"type": "string",
"description": "VAT ID. Only applicable for B2B customers."
}
}
},
"customer_read": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string",
"example": "1978-12-31",
"description": "Customer’s date of birth. The format is ‘yyyy-mm-dd’"
},
"gender": {
"type": "string",
"example": "male",
"description": "Customer’s gender - ‘male’ or ‘female’"
},
"organization_entity_type": {
"type": "string",
"description": "Organization entity type. Only applicable for B2B customers.",
"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": {
"type": "string",
"description": "Organization registration id. Only applicable for B2B customers."
},
"title": {
"type": "string",
"example": "Mr.",
"description": "Customer’s Title. Allowed values per country:\nUK - \"Mr\", \"Ms\"\nDE - \"Herr\", \"Frau\"\nAT: \"Herr, \"Frau\"\nCH: de-CH: \"Herr, \"Frau\" it-CH: \"Sig.\", \"Sig.ra\" fr-CH: \"M\", \"Mme\" \nBE: \"Dhr.\", \"Mevr.\"\nNL: \"Dhr.\", \"Mevr.\""
},
"type": {
"type": "string",
"example": "organization",
"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."
},
"vat_id": {
"type": "string",
"description": "VAT ID. Only applicable for B2B customers."
}
}
},
"customer_read_create_token": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string",
"example": "1978-12-31",
"description": "Customer’s date of birth. The format is ‘yyyy-mm-dd’"
},
"gender": {
"type": "string",
"example": "male",
"description": "Customer’s gender - ‘male’ or ‘female’"
}
}
},
"customer_token_creation_request": {
"type": "object",
"required": [
"description",
"intended_use",
"locale",
"purchase_country",
"purchase_currency"
],
"properties": {
"billing_address": {
"$ref": "#/components/schemas/address"
},
"customer": {
"$ref": "#/components/schemas/customer"
},
"description": {
"type": "string",
"description": "Description of the purpose of the token.",
"minLength": 1,
"maxLength": 255
},
"intended_use": {
"type": "string",
"description": "Intended use for the token.",
"enum": ["SUBSCRIPTION"]
},
"locale": {
"type": "string",
"example": "en-GB",
"description": "RFC 1766 customer's locale.",
"pattern": "^[A-Za-z]{2,2}(?:-[A-Za-z]{2,2})*$"
},
"purchase_country": {
"type": "string",
"example": "GB",
"description": "ISO 3166 alpha-2 purchase country.",
"pattern": "^[A-Za-z]{2,2}$"
},
"purchase_currency": {
"type": "string",
"example": "GBP",
"description": "ISO 4217 purchase currency.",
"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": {
"type": "string",
"example": "0b1d9815-165e-42e2-8867-35bc03789e00",
"description": "Used to connect customers with payment method when it is present."
},
"redirect_url": {
"type": "string",
"example": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect",
"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."
},
"token_id": {
"type": "string",
"example": "0b1d9815-165e-42e2-8867-35bc03789e00",
"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."
}
}
},
"merchant_session": {
"type": "object",
"required": ["client_token", "session_id"],
"properties": {
"client_token": {
"type": "string",
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJzZXNzaW9uX2lkIiA6ICIw",
"description": "Client token to be passed to the JS client while initializing the JS SDK in the next step.",
"maxLength": 4096,
"minLength": 0
},
"payment_method_categories": {
"type": "array",
"description": "Available payment method categories for this particular session",
"uniqueItems": true,
"items": {
"$ref": "#/components/schemas/payment_method_category"
}
},
"session_id": {
"type": "string",
"example": "0b1d9815-165e-42e2-8867-35bc03789e00",
"description": "ID of the created session. Please use this ID to share with Klarna for identifying any issues during integration.",
"maxLength": 255,
"minLength": 0
}
}
},
"merchant_urls": {
"type": "object",
"properties": {
"confirmation": {
"type": "string",
"example": "https://www.example-url.com/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).",
"minLength": 0,
"maxLength": 2000
},
"notification": {
"type": "string",
"example": "https://www.example-url.com/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).",
"minLength": 0,
"maxLength": 2000
},
"push": {
"type": "string",
"example": "https://www.example-url.com/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).",
"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": {
"type": "string",
"example": "#FF9900",
"description": "Color for the border of elements within the iFrame. Value should be a CSS hex color, e.g. \"#FF9900\"",
"pattern": "^#[A-Fa-f0-9]{6}$"
},
"color_border_selected": {
"type": "string",
"example": "#FF9900",
"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\"",
"pattern": "^#[A-Fa-f0-9]{6}$"
},
"color_details": {
"type": "string",
"example": "#FF9900",
"description": "Color for the bullet points within the iFrame. Value should be a CSS hex color, e.g. \"#FF9900\"",
"pattern": "^#[A-Fa-f0-9]{6}$"
},
"color_text": {
"type": "string",
"example": "#FF9900",
"description": "Color for the texts within the iFrame. Value should be a CSS hex color, e.g. \"#FF9900\"",
"pattern": "^#[A-Fa-f0-9]{6}$"
},
"radius_border": {
"type": "string",
"example": "5px",
"description": "Radius for the border of elements within the iFrame."
}
}
},
"order": {
"type": "object",
"required": ["order_id"],
"properties": {
"authorized_payment_method": {
"$ref": "#/components/schemas/authorized_payment_method"
},
"fraud_status": {
"type": "string",
"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."
},
"order_id": {
"type": "string",
"description": "Unique order ID of the transaction. This ID will be used for all order management processes."
},
"redirect_url": {
"type": "string",
"example": "https://credit.klarna.com/v1/sessions/0b1d9815-165e-42e2-8867-35bc03789e00/redirect",
"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."
}
}
},
"order_line": {
"type": "object",
"required": ["name", "quantity", "total_amount", "unit_price"],
"properties": {
"image_url": {
"type": "string",
"example": "https://www.exampleobjects.com/logo.png",
"description": "URL to an image that can be later embedded in communications between Klarna and the customer. (max 1024 characters).\n 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.",
"minLength": 0,
"maxLength": 1024
},
"merchant_data": {
"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\"}]}",
"description": "Used for storing merchant's internal order number or other reference. Pass through field. (max 1024 characters)",
"minLength": 0,
"maxLength": 1024
},
"name": {
"type": "string",
"example": "Running shoe",
"description": "Descriptive name of the order line item.",
"minLength": 1,
"maxLength": 255
},
"product_identifiers": {
"$ref": "#/components/schemas/product_identifiers"
},
"product_url": {
"type": "string",
"example": "https://.../AD6654412.html",
"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)",
"minLength": 0,
"maxLength": 1024
},
"quantity": {
"type": "integer",
"format": "int64",
"example": 1,
"description": "Quantity of the order line item. Must be a non-negative number.",
"minimum": 0
},
"quantity_unit": {
"type": "string",
"example": "pcs",
"description": "Unit used to describe the quantity, e.g. kg, pcs, etc. If defined the value has to be 1-8 characters.",
"minLength": 1,
"maxLength": 8
},
"reference": {
"type": "string",
"example": "AD6654412",
"description": "Client facing article number, SKU or similar. Max length is 256 characters.",
"minLength": 0,
"maxLength": 255
},
"tax_rate": {
"type": "integer",
"format": "int64",
"example": 2000,
"description": "Tax rate of the order line. Non-negative value. The percentage value is represented with two implicit decimals. I.e 2000 = 20%.",
"minimum": 0,
"maximum": 10000
},
"total_amount": {
"type": "integer",
"format": "int64",
"example": 2000,
"description": "Total amount of the order line. Must be defined as minor units. Includes tax and discount. Eg: 2000=20 euros\nValue = (quantity x unit_price) - total_discount_amount. \n(max value: 100000000)",
"maximum": 100000000
},
"total_discount_amount": {
"type": "integer",
"format": "int64",
"example": 500,
"description": "Non-negative minor units. Includes tax. Eg: 500=5 euros",
"minimum": 0
},
"total_tax_amount": {
"type": "integer",
"format": "int64",
"example": 333,
"description": "Total tax amount of the order line. Must be within ±1 of total_amount - total_amount 10000 / (10000 + tax_rate). Negative when type is discount."
},
"type": {
"type": "string",
"example": "physical",
"description": "Type of the order line item. The possible values are:\n\nphysical\ndiscount\nshipping_fee\nsales_tax\ndigital\ngift_card\nstore_credit\nsurcharge"
},
"unit_price": {
"type": "integer",
"format": "int64",
"example": 2500,
"description": "Price for a single unit of the order line. Must be defined as minor units. Includes tax, excludes discount. (max value: 100000000)",
"maximum": 100000000
},
"subscription": {
"$ref": "#/components/schemas/subscription"
}
}
},
"payment_method_category": {
"type": "object",
"properties": {
"asset_urls": {
"$ref": "#/components/schemas/asset_urls"
},
"identifier": {
"type": "string",
"example": "klarna",
"description": "ID of the payment method category to be used while loading the widget later.\nThe possible values are:<ul><li>klarna</li><li>pay_later</li><li>pay_now</li><li>pay_over_time</li><li>direct_bank_transfer</li><li>direct_debit</li></ul>"