Checkout
Last updatedCheckout Migration#
DTC API provides the checkout
field within the selection
that contains all the information related to the checkout process. We recommend including it only during the checkout stage because it triggers communication with external services and may result in increased response times.
The following examples use the checkoutSelectionFields fragment, which can have the following format:
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
fragment checkoutSelectionFields on Selection {
...selectionFields
checkout {
...checkoutFields
}
}
fragment checkoutFields on CheckoutSelection {
addressFields {
shippingAddress {
__typename
key
visible
required
...on CountryAddressField {
selected {
code
name
}
choices {
code
name
}
}
... on StateAddressField {
selected {
code
name
}
choices {
code
name
}
}
}
separateBillingAddress {
__typename
key
visible
required
...on CountryAddressField {
selected {
code
name
}
choices {
code
name
}
}
... on StateAddressField {
selected {
code
name
}
choices {
code
name
}
}
}
termsAndConditions {
__typename
key
visible
required
}
newsletter {
__typename
key
visible
required
}
}
checkoutScript
shippingAddress {
...addressFields
}
separateBillingAddress {
...addressFields
}
hasSeparateBillingAddress
paymentMethod {
...paymentMethodFields
}
paymentMethods {
...paymentMethodFields
}
shippingMethod {
...shippingMethodFields
}
shippingMethods {
...shippingMethodFields
}
widgets {
__typename
kind
... on IngridWidget {
snippet
sessionId
ingridAttributes
deliveryOptionsAvailable
reload
}
... on KlarnaPaymentWidget {
client_token
authorizePayload
replace_snippet
}
}
totals {
type
price {
value
formattedValue
}
... on SelectionTotalTaxRow {
taxPercent
}
}
}
fragment addressFields on Address {
firstName
lastName
address1
address2
city
zipCode
stateOrProvince
cellPhoneNumber
phoneNumber
faxNumber
email
companyName
attention
vatNumber
country {
code
name
}
state {
code
name
}
}
fragment shippingMethodFields on ShippingMethod {
id
comment
selected
name
price {
value
formattedValue
}
}
fragment paymentMethodFields on PaymentMethod {
active
addressAfterPayment
handlingCost {
value
formattedValue
}
id
initiateOnlySupported
kind
name
recurringSupported
}
fragment userErrorsFields on UserError {
message
path
... on UnavailableItem {
originalQuantity
unavailableQuantity
availableQuantity
item {
name
}
displayItem {
name
}
}
}
Checkout details#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Set shipping method | PUT /shipping-methods/{shippingMethod} | PUT /selections/{selection}/shipping-method/{shippingMethod} | setShippingMethod |
Set payment method | PUT /payment-methods/{paymentMethod} | PUT /selections/{selection}/payment-methods/{paymentMethod} | setPaymentMethod |
Payment fields | PUT /payment-fields | POST /selections/{selection}/payment-fields | PUT /selections/{selection}/checkout-fields |
Set shipping method#
Change shipping method for the current selection.
1
2
3
4
5
6
7
8
9
10
mutation {
setShippingMethod(id: 1) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Set payment method#
Change payment method for the current selection.
1
2
3
4
5
6
7
8
9
10
mutation {
setPaymentMethod(id: 1) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Payment fields#
The Payment fields endpoint serviced selection address updates, Centra Checkout script and controlled cart abandonment email. In DTC API these functions are split between a couple of mutations: setAddress: Update the selection address without processing to the payment step. Supports cart abandonment for the provided email.
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
mutation {
setAddress(
shippingAddress: {
firstName: "Peter"
lastName: "Petersson"
address1: "Street 1"
zipCode: "90210"
city: "San Francisco"
country: "US"
state: "CA"
}
separateBillingAddress: {
firstName: "Peter"
lastName: "Petersson"
address1: "Street 1"
zipCode: "12345"
city: "Stockholm"
country: "SE"
}
sendCartAbandonmentEmail: true
) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
handleWidgetEvent: Serves Centra checkout script events. Whenever it triggers an event - its payload needs to be sent in handleWidgetEvent
mutation. Additionally it accepts Ingrid attributes, that are then set on Ingrid session.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mutation IngridWidgetEvent($payload: Map!) {
handleWidgetEvent(payload: $payload) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
mutation SetIngridAttributes {
handleWidgetEvent(
payload: { ingridAttributes: ["Attribute1", "Attribute2"] }
) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Variables:
1
2
3
4
5
6
7
{
"payload": {
"additionalFields": {
"event": "ingrid_v2_shipping_option_changed"
}
}
}
Vouchers#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Add voucher | POST /vouchers | POST /selections/{selection}/vouchers/{voucher} | addVoucher |
Add URI voucher | POST /vouchers | POST /selections/{selection}/voucher-uri/{voucher} | lookupUri |
Remove voucher | DELETE /vouchers | DELETE /vouchers/{voucher} | DELETE /selections/{selection}/vouchers, DELETE /selections/{selection}/vouchers/{voucher} |
Remove URI voucher | DELETE /vouchers | DELETE /vouchers/{voucher} | DELETE /selections/{selection}/voucher-uri/{voucher} |
Add voucher#
Add voucher code to the current selection
1
2
3
4
5
6
7
8
9
10
mutation {
addVoucher(code: "voucher-code") {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Add URI voucher#
Add a URI voucher to the current selection. This type of voucher is provided to customers who visit a special URI on the site. DTC API applies it in the lookupUri
mutation.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
lookupUri(uri: "voucher-uri", for: [URL_VOUCHER]) {
... on UrlVoucherUriLookupPayload {
found
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
}
Remove voucher#
Remove a code voucher.
1
2
3
4
5
6
7
8
9
10
mutation {
removeVoucher(code: "voucher-code") {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Remove URI voucher#
To remove a URI voucher, use the removeVoucher
mutation. Provide the voucher URI instead of a code.
1
2
3
4
5
6
7
8
9
10
mutation {
removeVoucher(code: "voucher-uri") {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Ship from Store#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Set allocation rule | PUT /allocation-rule/{id} | PUT /selections/{selection}/allocation-rule/{allocationRule} | setAllocationRule |
Set Brick and mortar | PUT /brick-and-mortar/{id} | PUT /selections/{selection}/brick-and-mortar/{brickAndMortar} | setBrickAndMortar |
Fulfilment check | POST /fulfillment-check | POST /selections/{selection}/fulfillment-check | fulfillmentCheck |
Set allocation rule#
Set allocation rule to request for fulfillment of order.
1
2
3
4
5
6
7
8
9
10
mutation {
setAllocationRule(id: 1) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Set Brick and mortar#
Set Brick and mortar to request for fulfillment of order.
1
2
3
4
5
6
7
8
9
10
mutation {
setBrickAndMortar(id: 1) {
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Fulfilment check#
Check which brick and mortars that can fulfill the current selection, return sorted by stock level.
1
2
3
4
5
6
7
8
query {
fulfillmentCheck(brickAndMortarIds: [1, 2, 3]) {
availableInBrickAndMortars
userErrors {
...userErrorsFields
}
}
}
Payment process#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Payment instructions | POST /payment | POST /selections/{selection}/payment | paymentInstructions |
Payment result | POST /payment-result | POST /selections/{selection}/payment-result | paymentResult |
Payment instructions#
Initiate the payment process for the current selection. The following mutation is extended with optional fields to provide a more detailed example, but it's not required to send consents, clientDetails
, or customer customerClubSpecificFields
.
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
mutation {
paymentInstructions(
input: {
paymentInitiateOnly: false
paymentMethod: 1
paymentFailedPage: "http://example.com/failure"
paymentReturnPage: "http://example.com/success"
termsAndConditions: true
shippingMethod: 1
shippingAddress: {
firstName: "Test Billing"
lastName: "Testson Billing"
email: "abc123@example.com"
phoneNumber: "123456789"
address1: "Address One"
address2: "Address Two"
zipCode: "12345"
city: "Malmö"
country: "SE"
}
clientDetails: {
browserLanguage: "en-US"
ip: "192.168.0.1"
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
}
consents: [
{
key: "newsletter"
consented: true
name: "Constent 1"
data: "I approved X"
version: "1"
languageCode: "sv_SE"
}
]
affiliate: 1
comment: "Message from customer"
customerClubSpecificFields: {
voyadoPromotionId: "zyx321"
voyadoCustomerId: "xyz123"
}
}
) {
action {
action
... on FormPaymentAction {
html
formFields
formType
}
... on JavascriptPaymentAction {
script
formFields
formType
}
... on RedirectPaymentAction {
url
}
... on SuccessPaymentAction {
order {
...orderFields
}
}
}
selection {
...checkoutSelectionFields
}
userErrors {
...userErrorsFields
}
}
}
Payment result#
Send all variables received on paymentReturnPage
to verify if the order was finalized successfully or not.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mutation {
paymentResult(
paymentMethodFields: {
centraPaymentMethod: "klarna"
klarna_order: "XXYYZZ"
}
) {
type
selection {
...checkoutSelectionFields
}
... on PaymentResultSuccessPayload {
order {
...orderFields
}
}
userErrors {
...userErrorsFields
}
}
}
Other#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Address search | POST /address-search | POST /payment-methods/{paymentMethod}/address-search | - |
Receipt | GET /receipt | GET /selections/{selection}/receipt | order |
Address search#
DTC API doesn’t support address search.
Receipt#
Retrieve the receipt for the last order created in the current session. Additionally, you can obtain it upon a successful paymentResult
mutation.
1
2
3
4
5
query {
order {
...orderFields
}
}
Type transformation#
DTC API checkout#
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
{
"data": {
"addItem": {
"selection": {
"checkout": {
"totals": [
{
"type": "ITEMS_SUBTOTAL",
"price": {
"value": 388.8,
"formattedValue": "388.80 SEK"
}
},
{
"type": "DISCOUNT",
"price": {
"value": 0,
"formattedValue": "0.00 SEK"
}
},
{
"type": "CREDIT",
"price": {
"value": 0,
"formattedValue": "0.00 SEK"
}
},
{
"type": "SHIPPING",
"price": {
"value": 0,
"formattedValue": "0.00 SEK"
}
},
{
"type": "HANDLING",
"price": {
"value": 0,
"formattedValue": "0.00 SEK"
}
},
{
"type": "GRAND_TOTAL",
"price": {
"value": 388.8,
"formattedValue": "388.80 SEK"
}
},
{
"type": "INCLUDING_TAX",
"price": {
"value": 77.76,
"formattedValue": "77.76 SEK",
"taxPercent": 25
}
}
],
"addressFields": {
"shippingAddress": [
{
"__typename": "TextAddressField",
"key": "email",
"visible": true,
"required": true
},
{
"__typename": "TextAddressField",
"key": "company",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "firstName",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "lastName",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "address1",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "address2",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "zipCode",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "city",
"visible": false,
"required": false
},
{
"__typename": "StateAddressField",
"key": "state",
"visible": false,
"required": false,
"selected": null,
"choices": []
},
{
"__typename": "CountryAddressField",
"key": "country",
"visible": true,
"required": true,
"selected": {
"code": "SE",
"name": "Sweden"
},
"choices": [
{
"code": "AU",
"name": "Australia"
},
#list of countries
]
},
{
"__typename": "TextAddressField",
"key": "phoneNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "vatNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "houseNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "houseExtension",
"visible": false,
"required": false
}
],
"separateBillingAddress": [
{
"__typename": "TextAddressField",
"key": "email",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "company",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "firstName",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "lastName",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "address1",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "address2",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "zipCode",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "city",
"visible": false,
"required": false
},
{
"__typename": "StateAddressField",
"key": "state",
"visible": false,
"required": false,
"selected": null,
"choices": []
},
{
"__typename": "CountryAddressField",
"key": "country",
"visible": false,
"required": false,
"selected": null,
"choices": [
{
"code": "AF",
"name": "Afghanistan"
},
#list of countries
]
},
{
"__typename": "TextAddressField",
"key": "phoneNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "identityNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "houseNumber",
"visible": false,
"required": false
},
{
"__typename": "TextAddressField",
"key": "houseExtension",
"visible": false,
"required": false
}
],
"termsAndConditions": {
"__typename": "CheckboxAddressField",
"key": "termsAndConditions",
"visible": true,
"required": true
},
"newsletter": {
"__typename": "CheckboxAddressField",
"key": "newsletter",
"visible": true,
"required": false
}
},
"checkoutScript": "CentraCheckout = (function() {...})();",
"shippingAddress": {
"firstName": null,
"lastName": null,
"address1": null,
"address2": null,
"city": null,
"zipCode": null,
"stateOrProvince": null,
"cellPhoneNumber": null,
"phoneNumber": null,
"faxNumber": null,
"email": null,
"companyName": null,
"attention": null,
"vatNumber": null,
"country": {
"code": "SE",
"name": "Sweden"
},
"state": null
},
"separateBillingAddress": null,
"hasSeparateBillingAddress": false,
"paymentMethod": {
"active": true,
"addressAfterPayment": true,
"handlingCost": {
"value": 0,
"formattedValue": "0.00 SEK"
},
"id": 78,
"initiateOnlySupported": false,
"kind": "KLARNA_CHECKOUT_V3",
"name": "kco3",
"recurringSupported": true
},
"paymentMethods": [
{
"active": true,
"addressAfterPayment": true,
"handlingCost": {
"value": 0,
"formattedValue": "0.00 SEK"
},
"id": 78,
"initiateOnlySupported": false,
"kind": "KLARNA_CHECKOUT_V3",
"name": "kco3",
"recurringSupported": true
},
{
"active": false,
"addressAfterPayment": false,
"handlingCost": {
"value": 10,
"formattedValue": "10.00 SEK"
},
"id": 41,
"initiateOnlySupported": true,
"kind": "KLARNA_PAYMENTS",
"name": "Klarna Payments",
"recurringSupported": false
},
{
"active": false,
"addressAfterPayment": true,
"handlingCost": {
"value": 0,
"formattedValue": "0.00 SEK"
},
"id": 55,
"initiateOnlySupported": true,
"kind": "PAYPAL_COMMERCE",
"name": "PayPal Commerce",
"recurringSupported": false
},
{
"active": false,
"addressAfterPayment": false,
"handlingCost": {
"value": 0,
"formattedValue": "0.00 SEK"
},
"id": 37,
"initiateOnlySupported": true,
"kind": "ADYEN_DROPIN",
"name": "Adyen Drop-In",
"recurringSupported": true
}
],
"shippingMethod": {
"id": 1,
"comment": null,
"selected": true,
"name": "SEK",
"price": {
"value": 10,
"formattedValue": "10.00 SEK"
}
},
"shippingMethods": [
{
"id": 1,
"comment": null,
"selected": true,
"name": "SEK",
"price": {
"value": 10,
"formattedValue": "10.00 SEK"
}
}
],
"widgets": [
{
"__typename": "IngridWidget",
"kind": "SHIPPING",
"snippet": "<div id=\"shipwallet-container\" ... </div>",
"sessionId": "VM2-2515aa8dd1194353ba0ff6ddc278022e",
"ingridAttributes": null,
"deliveryOptionsAvailable": true,
"reload": true
}
]
}
},
"userErrors": []
}
},
"extensions": {
"token": "31fd7102-5eea-4933-ba3d-0b83ac853e61",
"traceId": "aec4e3ab1d00fc22303a2faf67bcf560"
}
}
Checkout API#
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
{
"token": "a4cc826b38d898a3cb2801cf0fc72903",
"selection": {
"language": "sv",
"currency": "SEK",
"paymentMethod": "adyen-drop-in",
"paymentMethodName": "Adyen Drop-In",
"shippingMethod": "sek",
"shippingMethodName": "SEK",
"pluginFields": {
"ingrid": {
"version": 2,
"snippet": "<div id=\"shipwallet-container\" ... </div>",
"session_id": "VM2-edfd2799f8324ea9ba90c86e5ed004fd",
"ingridAttributes": null,
"deliveryOptionsAvailable": true
},
"ingrid_v2_reload": true
},
"centraCheckoutScript": "CentraCheckout = (function() {...})();",
"items": [#list of items],
"discounts": {#applied discounts},
"totals": {
"itemsTotalPrice": "432.00 SEK",
"itemsTotalPriceAsNumber": 432,
"totalDiscountPrice": "-43.20 SEK",
"totalDiscountPriceAsNumber": -43.2,
"shippingPrice": "0.00 SEK",
"shippingPriceAsNumber": 0,
"handlingCostAddedToShippingPrice": false,
"totalQuantity": 2,
"taxDeducted": false,
"taxDeductedAsNumber": false,
"taxAdded": false,
"taxAddedAsNumber": false,
"taxPercent": 25,
"grandTotalPrice": "388.80 SEK",
"grandTotalPriceAsNumber": 388.8,
"grandTotalPriceTax": "77.76 SEK",
"grandTotalPriceTaxAsNumber": 77.76
},
"vatExempt": false,
"address": {
"firstName": "",
"lastName": "",
"email": "",
"phoneNumber": "",
"company": "",
"address1": "",
"address2": "",
"zipCode": "",
"city": "",
"state": "",
"country": "",
"vatNumber": ""
},
"shippingAddress": {
"firstName": "",
"lastName": "",
"email": "",
"phoneNumber": "",
"company": "",
"address1": "",
"address2": "",
"zipCode": "",
"city": "",
"state": "",
"country": ""
},
"additionalNotes": "",
"currencyFormat": {#currency fields}
},
"paymentMethods": [
{
"paymentMethod": "adyen-drop-in",
"name": "Adyen Drop-In",
"paymentMethodType": "adyen_drop_in",
"supportsInitiateOnly": true,
"supportsRecurring": true,
"providesCustomerAddressAfterPayment": false,
"clientSide": {
"externalScript": "https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/4.7.3/adyen.js"
},
"handlingCost": "0.00 SEK",
"handlingCostAsNumber": 0
},
{
"paymentMethod": "kco3-5f-01",
"name": "kco3",
"paymentMethodType": "klarna_checkout",
"supportsInitiateOnly": false,
"supportsRecurring": true,
"providesCustomerAddressAfterPayment": true,
"handlingCost": "0.00 SEK",
"handlingCostAsNumber": 0
},
{
"paymentMethod": "klarna-payments-eu",
"name": "Klarna Payments",
"paymentMethodType": "klarna_payments",
"supportsInitiateOnly": true,
"supportsRecurring": false,
"providesCustomerAddressAfterPayment": false,
"handlingCost": "10.00 SEK",
"handlingCostAsNumber": 10
},
{
"paymentMethod": "paypal-tadek",
"name": "PayPal Commerce",
"paymentMethodType": "paypal_commerce",
"supportsInitiateOnly": true,
"supportsRecurring": false,
"providesCustomerAddressAfterPayment": true,
"handlingCost": "0.00 SEK",
"handlingCostAsNumber": 0
}
],
"paymentFields": {
"termsAndConditions": {
"type": "boolean",
"required": true,
"visible": true
},
"address": {
"email": {
"type": "string",
"required": true,
"visible": true
},
"company": {
"type": "string",
"required": false,
"visible": false
},
"firstName": {
"type": "string",
"required": false,
"visible": false
},
"lastName": {
"type": "string",
"required": false,
"visible": false
},
"address1": {
"type": "string",
"required": false,
"visible": false
},
"address2": {
"type": "string",
"required": false,
"visible": false
},
"zipCode": {
"type": "string",
"required": false,
"visible": false
},
"city": {
"type": "string",
"required": false,
"visible": false
},
"state": {
"type": "string",
"required": false,
"visible": true
},
"country": {
"type": "string",
"required": true,
"visible": true
},
"phoneNumber": {
"type": "string",
"required": false,
"visible": false
},
"identityNumber": {
"type": "string",
"required": false,
"visible": false
},
"vatNumber": {
"type": "string",
"required": false,
"visible": false
},
"houseNumber": {
"type": "string",
"required": false,
"visible": false
},
"houseExtension": {
"type": "string",
"required": false,
"visible": false
},
"newsletter": {
"type": "boolean",
"required": false,
"visible": true
}
},
"shippingAddress": {
"email": {
"type": "string",
"required": false,
"visible": false
},
"company": {
"type": "string",
"required": false,
"visible": false
},
"firstName": {
"type": "string",
"required": false,
"visible": false
},
"lastName": {
"type": "string",
"required": false,
"visible": false
},
"address1": {
"type": "string",
"required": false,
"visible": false
},
"address2": {
"type": "string",
"required": false,
"visible": false
},
"zipCode": {
"type": "string",
"required": false,
"visible": false
},
"city": {
"type": "string",
"required": false,
"visible": false
},
"state": {
"type": "string",
"required": false,
"visible": false
},
"country": {
"type": "string",
"required": false,
"visible": false
},
"phoneNumber": {
"type": "string",
"required": false,
"visible": false
},
"houseNumber": {
"type": "string",
"required": false,
"visible": false
},
"houseExtension": {
"type": "string",
"required": false,
"visible": false
}
}
},
"shippingMethods": [
{
"shippingMethod": "sek",
"name": "SEK",
"price": "10.00 SEK",
"priceAsNumber": 10
}
],
"countries": [#list of countries],
"languages": [#list of languages],
"location": {#location fields}
}
}
Shop API#
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
{
"line": "23da22691105ff35b424b05f0dd6e0b9",
"selection": "924d92c1beef2e97763de5073a0cfbee",
"country": "SE",
"customer": "",
"market": "1",
"pricelist": "19",
"language": null,
"currency": "SEK",
"paymentMethod": null,
"paymentMethodName": "",
"shippingMethod": "sek",
"shippingMethodName": "SEK",
"paymentMethodsAvailable": {
"adyen-drop-in": {
"paymentMethod": "adyen-drop-in",
"name": "Adyen Drop-In",
"paymentMethodType": "adyen_drop_in",
"useForDigitalContent": true,
"supportsInitiateOnly": true,
"supportsRecurring": true,
"providesCustomerAddressAfterPayment": false,
"addressRequiredFields": [
"email",
"firstName",
"lastName",
"address1",
"zipCode",
"city",
"country"
],
"hasTermsAndConditionsAgreement": false,
"clientSide": {
"externalScript": "https://checkoutshopper-test.adyen.com/checkoutshopper/sdk/4.7.3/adyen.js"
}
},
"kco3-5f-01": {
"paymentMethod": "kco3-5f-01",
"name": "kco3",
"paymentMethodType": "klarna_checkout",
"useForDigitalContent": false,
"supportsInitiateOnly": false,
"supportsRecurring": true,
"providesCustomerAddressAfterPayment": true,
"addressRequiredFields": [
"country"
],
"hasTermsAndConditionsAgreement": true
},
"klarna-payments-eu": {
"paymentMethod": "klarna-payments-eu",
"name": "Klarna Payments",
"paymentMethodType": "klarna_payments",
"useForDigitalContent": true,
"supportsInitiateOnly": true,
"supportsRecurring": false,
"providesCustomerAddressAfterPayment": false,
"addressRequiredFields": [
"email",
"firstName",
"lastName",
"address1",
"zipCode",
"city",
"country"
],
"hasTermsAndConditionsAgreement": false,
"handlingCostByPricelist": {
"19": {
"price": "10.00 SEK",
"priceAsNumber": 10
}
}
},
"paypal-tadek": {
"paymentMethod": "paypal-tadek",
"name": "PayPal Commerce",
"paymentMethodType": "paypal_commerce",
"useForDigitalContent": true,
"supportsInitiateOnly": true,
"supportsRecurring": false,
"providesCustomerAddressAfterPayment": true,
"addressRequiredFields": [
"country"
],
"hasTermsAndConditionsAgreement": false
}
},
"shippingMethodsAvailable": {
"sek": {
"shippingMethod": "sek",
"name": "SEK",
"price": "10.00 SEK",
"priceAsNumber": 10
}
},
"ingrid": {
"version": 2,
"snippet": "<div id=\"shipwallet-container\" ... </div>",
"session_id": "VM2-2f98e75b15a14840b01c98b76f9bfb80",
"ingridAttributes": null,
"deliveryOptionsAvailable": true
},
"ingrid_v2_reload": true,
"centraCheckoutScript": "CentraCheckout = (function() {...})();",
"items": [#list of items],
"discounts": {#applied discounts},
"totals": {
"itemsTotalPrice": "432.00 SEK",
"itemsTotalPriceAsNumber": 432,
"totalDiscountPrice": "-43.20 SEK",
"totalDiscountPriceAsNumber": -43.2,
"shippingPrice": "0.00 SEK",
"shippingPriceAsNumber": 0,
"handlingCostPrice": "0.00 SEK",
"handlingCostPriceAsNumber": 0,
"totalQuantity": 2,
"taxDeducted": false,
"taxDeductedAsNumber": false,
"taxAdded": false,
"taxAddedAsNumber": false,
"taxPercent": 25,
"grandTotalPrice": "388.80 SEK",
"grandTotalPriceAsNumber": 388.8,
"grandTotalPriceTax": "77.76 SEK",
"grandTotalPriceTaxAsNumber": 77.76
},
"vatExempt": false,
"address": {
"firstName": "",
"lastName": "",
"email": "",
"phoneNumber": "",
"company": "",
"address1": "",
"address2": "",
"zipCode": "",
"city": "",
"state": "",
"country": "",
"vatNumber": ""
},
"shippingAddress": {
"firstName": "",
"lastName": "",
"email": "",
"phoneNumber": "",
"company": "",
"address1": "",
"address2": "",
"zipCode": "",
"city": "",
"state": "",
"country": "",
"vatNumber": ""
},
"additionalNotes": "",
"currencyFormat": {#currency fields}
}
Address#
Shipping address fields can be found under selection.checkout.shippingAddress
. Address fields can be found under selection.checkout.separateBillingAddress
. Both addresses contain the same fields as in Checkout API and Shop API. In case the billing address is null, you need to use empty strings to follow the format of the prior APIs.
Payment methods#
DTC API provides available payment methods under selection.checkout.paymentMethods
, and the selected payment method is duplicated under selection.checkout.paymentMethod
. DTC API payment methods operate on IDs instead of URIs, which is why each payment method contains an ID but not a URI.
Shipping methods#
Shipping methods in DTC API behave similarly to payment methods. You can find them under selection.checkout.shippingMethods
, and they are also identified by ID instead of URI.
Widgets#
Widgets related to Ingrid or Klarna can be found under selection.checkout.widgets
. You can distinguish them by adding the __typename
field. All the widget fields available in prior APIs are also exposed in DTC API.
Totals#
DTC API provides selection totals under selection.checkout.totals
. This list contains the selection summary per type.
Checkout API | Shop API | DTC API |
---|---|---|
itemsTotalPriceAsNumber | itemsTotalPriceAsNumber | ITEMS_SUBTOTAL + discounts applied on lines. |
totalDiscountPriceAsNumber | totalDiscountPriceAsNumber | DISCOUNT + CREDIT |
shippingPriceAsNumber | shippingPriceAsNumber | SHIPPING |
handlingCostAddedToShippingPrice | handlingCostPriceAsNumber | HANDLING |
totalQuantity | totalQuantity | Sum of line.quantity |
taxDeductedAsNumber | taxDeductedAsNumber | TAX_DEDUCT.taxPercent |
taxAddedAsNumber | taxAddedAsNumber | TAX_ADDED.taxPercent |
taxPercent | taxPercent | INCLUDING_TAX.taxPercent |
grandTotalPriceAsNumber | grandTotalPriceAsNumber | GRAND_TOTAL |
grandTotalPriceTaxAsNumber | grandTotalPriceTaxAsNumber | INCLUDING_TAX or TAX_ADDED |
Address fields#
The rules for address fields can be found under selection.checkout.addressFields
. Each address field provides information on whether the field has to be visible and required. You can use the address field __typename to decide how it has to be displayed, whether it's a text field, checkbox, or selector. Additionally, DTC API provides a list of available choices for selectors, such as a list of countries or states.