First interaction to order - Happy Path
Last updatedAdd product#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Add item | POST /items/{item} POST /items/{item}/quantity/{quantity} | POST /selections/{selection}/items/{item} POST /selections/{selection}/items/{item}/quantity/{quantity} | addItem |
Add flexible bundle | POST /items/bundles/{item} | POST /selections/{selection}/bundles | addFlexibleBundle |
Add gift certificate | POST /items/gift-certificates/{giftCertificate} POST /items/gift-certificates/{giftCertificate}/amount/{amount} | POST /selections/{selection}/gift-certificates/{giftCertificate} POST/selections/{selection}/gift-certificates/{giftCertificate}/amount/{amount} | Not supported |
Add Item#
Add product or static bundle to the selection.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
addItem(item: "1-1") {
line {
...LineFragment
}
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Add flexible bundle#
Flexible bundles can consist of different numbers of sections. For example, a bundle can be a custom set of dinner dishes - a selectable soup vase, two bowls and any number of dinner plates - for 1, 2 or 4 persons, each separately selectable. Because the number of sections is not absolute, these are not possible to be defined as a fixed bundle.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mutation {
addFlexibleBundle(item: "10-1", sections: [
{
sectionId: 1
item: "2-2"
}
{
sectionId: 2
item: "3-1"
}
]) {
line {
...lineFields
}
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Add gift certificate#
Gift certificates are currently not supported in the DTC API.
Line modifications#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Increase line quantity | POST /lines/{line} POST /lines/{line}/quantity/{quantity} | POST /selections/{selection}/lines/{line} POST /selections/{selection}/lines/{line}/quantity/{quantity} | Not supported |
Reduce line quantity | DELETE /lines/{line}/quantity/{quantity} | DELETE /selections/{selection}/lines/{line}/quantity/{quantity} | Not supported |
Reduce item quantity | Not supported | DELETE /selections/{selection}/items/{item}/quantity/{quantity} | Not supported |
Delete line | DELETE /lines/{line} | DELETE /selections/{selection}/lines/{line} | deleteLine |
Delete item | Not supported | DELETE /selections/{selection}/items DELETE/selections/{selection}/items/{item} | Not supported |
Set line quantity | PUT /lines/{line}/quantity/{quantity} | PUT /selections/{selection}/lines/{line}/quantity/{quantity} | updateLine |
Set item quantity | Not supported | PUT /selections/{selection}/items/{item}/quantity/{quantity} | Not supported |
Remove line subscription plan | DELETE /lines/{line}/subscription-plan | DELETE /selections/{selection}/lines/{line}/subscription-plan | removeSubscriptionPlanFromLine |
Update line subscription plan | PUT /lines/{line}/subscription-plan/{subscriptionPlan} | PUT /selections/{selection}/lines/{line}/subscription-plan/{subscriptionPlan} | updateLine |
Increase line quantity#
We recommend using the updateLine mutation described in Set line quantity section, where you can provide an updated line quantity to increase it. At the same time, the closest alternative to incrementally increase quantity is to execute addItem or addFlexibleBundle mutation for the same item. In case a line doesn’t have any unique components e.g. comment, subscription plan etc, mutation quantity is added to an item line.
"Add line quantity" means that you're increasing the number of units for an existing product in the cart.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mutation {
addItem(
item: "1-1"
quantity: 3
) {
line {
...lineFields
}
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Reduce line quantity#
We recommend to use updateLine mutation described in Set line quantity section, where you can provide an updated line quantity to reduce it.
Reduce item quantity#
DTC API operates on lines instead of items and we recommend to use the updateLine mutation described in Set line quantity section, where you can provide an updated line quantity to reduce it.
Delete line#
Use deleteLine to delete the selection line.
1
2
3
4
5
6
7
8
9
10
11
12
mutation {
deleteLine (
lineId: "608bf7956e1e20e8e36c8736d88a02e9"
) {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Delete item#
DTC API operates on lines instead of items, where multiple line can present the same item, but with different details (comment, subscription etc.). We recommend to use deleteLine mutation described in Delete line section for that purpose.
Set line quantity#
Use updateLine to set the specific quantity on the selection line.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
updateLine (
lineId: "608bf7956e1e20e8e36c8736d88a02e9"
quantity: 5
) {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Set item quantity#
DTC API operates on lines instead of items, where multiple line can present the same item, but with different details (comment, subscription etc.). We recommend to updateLine mutation, that is described in Set line quantity section, where you can provide an updated line quantity.
Remove line subscription plan#
Use removeSubscriptionPlanFromLine to remove line subscription plan.
1
2
3
4
5
6
7
8
9
10
11
12
mutation {
removeSubscriptionPlanFromLine(
lineId: "608bf7956e1e20e8e36c8736d88a02e9"
) {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Update line subscription plan#
Use updateLine mutation to update line subscription plan.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
updateLine (
lineId: "608bf7956e1e20e8e36c8736d88a02e9"
subscriptionPlanId: 1
) {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Selection modifications#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Change country | PUT /countries/{country} | PUT /countries/{country}/states/{state} | PUT /selections/{selection}/countries/{country} |
Update market | PUT /selection | PUT /selections/{selection}/markets/{market} | setMarket |
Update pricelist | PUT /selection | PUT /selections/{selection}/pricelists/{pricelist} | Dependent on country |
Change language | PUT /languages/{language} | PUT /selections/{selection}/languages/{language} | setLanguage |
Set campaign site | PUT /campaign-site | Not supported | setCampaignSite |
Set affiliate | Not supported | Not supported | setAffiliate |
Remove customer | Not supported | DELETE /selections/{selection}/customers | Not supported |
Attach customer | Not supported | PUT /selections/{selection}/customers/{customer} | Not supported |
Set VAT exempt | Not supported | PUT /selections/{selection}/vat-exempt/{vatExempt} | Not supported |
Change country#
Use setCountryState to change the selection country.
1
2
3
4
5
6
7
8
9
10
mutation {
setCountryState(countryCode: "SE") {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Update market#
Set market on the selection.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
setMarket(id: 1) {
session {
...sessionFields
}
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Update pricelist#
DTC API doesn’t support direct pricelist change. Pricelist is dependent on country and changes according to the selection country.
Change language#
Set language on the selection.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
setLanguage(code: "en") {
session {
...sessionFields
}
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Set campaign site#
Set campaign site on the selection.
Option 1:
1
2
3
4
5
6
7
8
9
10
11
12
mutation {
setCampaignSite(
uri: "sweden-secret-30"
){
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Option 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mutation {
lookupUri(uri: "sweden-secret-30", for: [CAMPAIGN_SITE]) {
found
... on CampaignSiteUriLookupPayload {
campaignSite {
...campaignSiteFields
}
selection {
...selectionFields
}
}
userErrors {
...userErrorsFields
}
}
}
Set affiliate#
Set affiliate on the selection.
Option 1:
1
2
3
4
5
6
7
8
9
10
11
12
mutation setAffiliate {
setAffiliate(
uri: "affiliate-30"
){
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Option 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mutation {
lookupUri(uri: "affiliate-30", for: [AFFILIATE]) {
found
... on AffiliateUriLookupPayload {
affiliate {
...affiliateFields
}
selection {
...selectionFields
}
}
userErrors {
...userErrorsFields
}
}
}
Remove customer#
Remove customer functionality is only available in Shop API due to its specification. DTC API is based on session, and the customer is detached only on logout action.
Attach customer#
Attach customer functionality is only available in Shop API due to its specification. DTC API is based on session, and the customer is attached only on login action.
Set VAT exempt#
Set VAT exempt functionality is only available in Shop API. In DTC API, VAT exempt is set if VAT number is provided and valid.
Other endpoints#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Create selection | Created with first selection modification | POST /selections | Created with first selection modification |
Get selection | GET /selection | GET /selections/{selection} | selection |
Attach selection | PUT /selection/{selection} | No matches | setSelection |
Claim selection | Not supported | POST /payment-links/{hash1}/{hash2} | claimSelection |
Create selection#
DTC API creates a selection on the first selection modification. It can be either an item addition, market or country set action, or anything else that modifies the selection.
Get selection#
Use selection query to get the current selection.
1
2
3
4
5
query {
selection {
...selectionFields
}
}
Attach selection#
Use setSelection to attach selection to the shopper’s session.
1
2
3
4
5
6
7
8
9
10
mutation {
setSelection(id: "1631f6dfefefd071966fc025d9b05828") {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Claim selection#
Prefilled selections in AMS, accompanied by a generated selection link, can be integrated into a shopper's session using the claimSelection mutation in the DTC API. This feature allows the claimed selections to be utilized multiple times until one of them is eventually finalized.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
claimSelection(
id: "1631f6dfefefd071966fc025d9b05828"
hash: "90651f7f3148a078fbc4ae8af0a4e223"
) {
selection {
...selectionFields
}
userErrors {
...userErrorsFields
}
}
}
Selection Fields#
In both Checkout API and Shop API, each selection-related call yields the same response format. Similarly, DTC API also provides the current selection, which can be transformed into the format returned by Checkout API or Shop API. This transformation process ensures that all necessary pre-checkout information is included. Below are the required fields for the transformation
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
fragment selectionFields on Selection {
id
comment
lines {
...lineFields
}
grandTotal {
value
formattedValue
}
language {
code
}
discounts {
name
appliedOn
method
type
value {
value
formattedValue
}
... on CodeVoucher {
code
}
... on UrlVoucher {
url
}
}
taxExempt
brickAndMortar {
id
}
}
fragment lineFields on Line {
id
name
productVariantName
size
productNumber
comment
addedFromCategory {
id
name
}
productExternalUrl
brand {
name
}
item {
id
name
sku
GTIN
preorder
stock {
available
}
}
appliedPromotions {
type
percent
value {
value
formattedValue
}
... on AppliedLineItemVoucher {
name
}
}
hasDiscount
unitPrice {
value
formattedValue
}
unitOriginalPrice {
value
formattedValue
}
unitPriceReduction {
value
formattedValue
}
lineValue {
value
formattedValue
}
originalLineValue {
value
formattedValue
}
discountPercent
taxPercent
quantity
subscriptionId
displayItem {
id
}
... on BundleLine {
bundle {
id
sections {
id
quantity
lines {
id
}
}
}
}
}
fragment userErrorsFields on UserError {
message
path
... on UnavailableItem {
originalQuantity
unavailableQuantity
availableQuantity
item {
name
}
displayItem {
name
}
}
}
DTC API response
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
{
"data": {
"addItem": {
"selection": {
"id": "7582470b7e9ad7064c2b0e9c0121f822",
"comment": null,
"lines": [
{
"id": "592a0f3512664a389bf693abbd9279d9",
"name": "Test Product",
"productVariantName": "Red",
"size": "one",
"productNumber": "123456789",
"comment": "",
"addedFromCategory": null,
"productExternalUrl": null,
"brand": {
"name": "Brand"
},
"item": {
"id": "1-1",
"name": "one",
"sku": "123456789",
"GTIN": "ABCDEFGHIJKL",
"preorder": false,
"stock": {
"available": true
}
},
"appliedPromotions": [
{
"type": "VOUCHER",
"percent": 10,
"value": {
"value": -21.6,
"formattedValue": "-21.60 SEK"
},
"name": "10%"
},
{
"type": "CAMPAIGN",
"percent": 10,
"value": {
"value": -24,
"formattedValue": "-24.00 SEK"
}
}
],
"hasDiscount": true,
"unitPrice": {
"value": 194.4,
"formattedValue": "194.40 SEK"
},
"unitOriginalPrice": {
"value": 240,
"formattedValue": "240.00 SEK"
},
"unitPriceReduction": {
"value": 45.6,
"formattedValue": "45.60 SEK"
},
"lineValue": {
"value": 388.8,
"formattedValue": "388.80 SEK"
},
"originalLineValue": {
"value": 480,
"formattedValue": "480.00 SEK"
},
"discountPercent": 19,
"taxPercent": 25,
"quantity": 2,
"subscriptionId": null,
"displayItem": {
"id": 1
}
}
],
"grandTotal": {
"value": 398.8,
"formattedValue": "398.80 SEK"
},
"language": {
"code": "sv"
},
"discounts": [
{
"name": "10%",
"appliedOn": [
"LINES"
],
"method": "AUTO",
"type": "DISCOUNT",
"value": {
"value": -43.2,
"formattedValue": "-43.20 SEK"
}
}
],
"taxExempt": null,
"brickAndMortar": null
},
"userErrors": []
}
},
"extensions": {
"token": "435e3c03-44be-452f-be06-6064eb650dd6",
"traceId": "d7891b055011af7fdcbcd35ed326182e"
}
}
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
{
"token": "a4cc826b38d898a3cb2801cf0fc72903",
"selection": {
"language": "sv",
"currency": "SEK",
"paymentMethod": "adyen-drop-in",
"paymentMethodName": "Adyen Drop-In",
"shippingMethod": "sek",
"shippingMethodName": "SEK",
"centraCheckoutScript": "CentraCheckout = (function() {...})();",
"items": [
{
"item": "1-1",
"productUrl": null,
"category": null,
"size": "one",
"sku": "123456789",
"ean": "ABCDEFGHIJKL",
"upc": "",
"quantity": 2,
"comment": null,
"localizedSize": null,
"campaign": {
"name": "Retail campaign",
"discount": "24.00 SEK",
"discountAsNumber": 24
},
"line": "f1c720cd549e659745e8117e8277f9e6",
"priceEach": "216.00 SEK",
"priceEachAsNumber": 216,
"totalPrice": "432.00 SEK",
"totalPriceAsNumber": 432,
"priceEachBeforeDiscount": "240.00 SEK",
"priceEachBeforeDiscountAsNumber": 240,
"anyDiscount": true,
"discounts": {
"totalDiscount": "-43.20 SEK",
"totalDiscountAsNumber": -43.2,
"totalOriginalDiscount": "-43.20 SEK",
"totalOriginalDiscountAsNumber": -43.2,
"vouchers": null,
"automaticDiscounts": [
{
"automaticDiscount": 24,
"priceOff": "-43.20 SEK",
"priceOffAsNumber": -43.2,
"hasAffectedItemPrice": false
}
]
},
"taxPercent": 25,
"priceEachWithoutTax": "172.80 SEK",
"priceEachWithoutTaxAsNumber": 172.8,
"priceEachReduction": "24.00 SEK",
"priceEachReductionAsNumber": 24,
"totalPriceBeforeDiscount": "480.00 SEK",
"totalPriceBeforeDiscountAsNumber": 480,
"totalPriceAfterCampaign": "432.00 SEK",
"totalPriceAfterCampaignAsNumber": 432,
"totalPriceAfterDiscount": "388.80 SEK",
"totalPriceAfterDiscountAsNumber": 388.8,
"product": {#displayItemFields}
}
],
"discounts": {
"anyDiscount": true,
"discount": "-43.20 SEK",
"discountAsNumber": -43.2,
"vouchers": [],
"automaticDiscounts": [
{
"automaticDiscount": 24,
"name": "10%",
"priceOff": "-43.20 SEK",
"priceOffAsNumber": -43.2,
"isCredit": false,
"originalPriceOff": "-43.20 SEK",
"originalPriceOffAsNumber": -43.2,
"expiryDate": "2025-02-06 16:47:42",
"lines": [
"f1c720cd549e659745e8117e8277f9e6"
],
"shippingDiscountAsNumber": 0,
"shippingDiscount": "0.00 SEK",
"attributes": []
}
]
},
"totals": {#totals},
"vatExempt": false,
"address": {#addressFields},
"shippingAddress": {#shippingAddressFields},
"additionalNotes": "",
"currencyFormat": {
"currency": "SEK",
"name": "SEK",
"prefix": "",
"suffix": " SEK",
"decimalPoint": ".",
"decimalDigits": "2",
"thousandsSeparator": " ",
"denominator": 100,
"uri": "sek"
}
},
"paymentMethods": [#paymentMethods],
"paymentFields": {#paymentFields},
"shippingMethods": [#shippingMethods],
"countries": [
{
"country": "SE",
"name": "Sweden",
"eu": true,
"language": "sv",
"currency": "SEK"
},
#countries
],
"languages": [
{
"language": "en",
"name": "English",
"default": true
},
#languages
],
"location": {
"country": "SE",
"name": "Sweden",
"state": null,
"stateName": "",
"eu": true,
"shipTo": true,
"market": 1,
"pricelist": 19,
"language": {
"language": "sv",
"name": "Swedish",
"default": false
}
}
}
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
{
"line": "04cb723eacd5ecfcebf7440aa5873d92",
"selection": "b7a63a1e57a7067b66bc495cd22789be",
"country": "",
"customer": "",
"market": "1",
"pricelist": "19",
"language": null,
"currency": "SEK",
"paymentMethod": null,
"paymentMethodName": "",
"shippingMethod": "",
"shippingMethodName": "",
"paymentMethodsAvailable": {#paymentMethodsFields},
"shippingMethodsAvailable": [],
"centraCheckoutScript": "CentraCheckout = (function() {...})();",
"items": [
{
"item": "1-1",
"product": "1",
"brandName": "Brand",
"productName": "Test Product",
"productUrl": null,
"category": null,
"size": "one",
"sku": "123456789",
"ean": "ABCDEFGHIJKL",
"upc": "",
"silkProduct": "1",
"silkVariant": "1445",
"quantity": 2,
"comment": "",
"localizedSize": null,
"campaign": {
"name": "Retail campaign",
"discount": "24.00 SEK",
"discountAsNumber": 24
},
"line": "04cb723eacd5ecfcebf7440aa5873d92",
"priceEach": "216.00 SEK",
"priceEachAsNumber": 216,
"totalPrice": "432.00 SEK",
"totalPriceAsNumber": 432,
"priceEachBeforeDiscount": "240.00 SEK",
"priceEachBeforeDiscountAsNumber": 240,
"anyDiscount": true,
"discounts": {
"totalDiscount": "-43.20 SEK",
"totalDiscountAsNumber": -43.2,
"totalOriginalDiscount": "-43.20 SEK",
"totalOriginalDiscountAsNumber": -43.2,
"vouchers": null,
"automaticDiscounts": [
{
"automaticDiscount": 24,
"priceOff": "-43.20 SEK",
"priceOffAsNumber": -43.2,
"hasAffectedItemPrice": false
}
]
},
"taxPercent": 25,
"priceEachWithoutTax": "172.80 SEK",
"priceEachWithoutTaxAsNumber": 172.8,
"priceEachReduction": "24.00 SEK",
"priceEachReductionAsNumber": 24,
"totalPriceBeforeDiscount": "480.00 SEK",
"totalPriceBeforeDiscountAsNumber": 480,
"totalPriceAfterCampaign": "432.00 SEK",
"totalPriceAfterCampaignAsNumber": 432,
"totalPriceAfterDiscount": "388.80 SEK",
"totalPriceAfterDiscountAsNumber": 388.8
}
],
"discounts": {
"anyDiscount": true,
"discount": "-43.20 SEK",
"discountAsNumber": -43.2,
"vouchers": [],
"automaticDiscounts": {
"24": {
"automaticDiscount": 24,
"name": "10%",
"priceOff": "-43.20 SEK",
"priceOffAsNumber": -43.2,
"isCredit": false,
"originalPriceOff": "-43.20 SEK",
"originalPriceOffAsNumber": -43.2,
"expiryDate": "2025-02-06 16:47:42",
"lines": [
"04cb723eacd5ecfcebf7440aa5873d92"
],
"shippingDiscountAsNumber": 0,
"shippingDiscount": "0.00 SEK",
"attributes": []
}
}
},
"totals": {#totals},
"vatExempt": false,
"address": {#addressFields},
"shippingAddress": {#shippingAddressFields},
"additionalNotes": "",
"currencyFormat": {
"currency": "SEK",
"name": "SEK",
"prefix": "",
"suffix": " SEK",
"decimalPoint": ".",
"decimalDigits": "2",
"thousandsSeparator": " ",
"denominator": 100,
"uri": "sek"
}
}
Line prices#
Checkout API | Shop API | DTC API |
---|---|---|
priceEachAsNumber | priceEachAsNumber | line.unitOriginalPrice - applied campaigns appliedPromotions.value.value * quantity |
priceEachWithoutTaxAsNumber | priceEachWithoutTaxAsNumber | (line.unitOriginalPrice - applied campaigns appliedPromotions.value.value * quantity) / tax percent |
priceEachBeforeDiscountAsNumber | priceEachBeforeDiscountAsNumber | line.unitOriginalPrice |
priceEachReductionAsNumber | priceEachReductionAsNumber | line.unitPriceReduction (includes campaign + voucher) |
totalPriceBeforeDiscountAsNumber | totalPriceBeforeDiscountAsNumber | line.originalLineValue |
totalPriceAsNumber | totalPriceAsNumber | line.lineValue + line vouchers appliedPromotions.value.value * line quantity |
totalPriceAfterCampaignAsNumber | totalPriceAfterCampaignAsNumber | line.originalLineValue - applied campaigns * line quantity |
totalPriceAfterDiscountAsNumber | totalPriceAfterDiscountAsNumber | line.lineValue |
anyDiscount | anyDiscount | line.hasDiscount |
taxPercent | taxPercent | line.taxPercent |
Note: Unlike Checkout API and Shop API, which only include campaign promotions in line prices, the DTC API includes all applied promotions. Therefore, to match the previous price format, you will need to calculate certain values independently.
Line discounts and campaigns
The DTC API returns the field line.appliedPromotions, which includes all line vouchers and campaigns.
- The CAMPAIGN promotion type contains the campaign discount value per one item piece.
- The VOUCHER promotion type contains a voucher discount value per one item piece. To calculate the total discount, you need to multiply it by the line quantity. To distinguish between auto and code or URI vouchers, you can find detailed voucher information in selection.discounts and check if discount.method is AUTO.
Selection discounts
Detailed selection discount data can be found under selection.discounts. Use discounts.type to determine whether a voucher is credit or not. You can search for the voucher name in the line's applied promotions to collect line IDs. The DTC API doesn't support a separate shipping discount value, nor does it provide an expiry date.
Session data
Some information presented in Checkout API and Shop API selection response can only be found in the DTC API session. Utilize the following query to retrieve it.
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
query Session {
session {
country {
code
name
isEU
shipTo
}
countryState {
code
name
}
market {
id
}
pricelist {
id
currency {
id
name
code
currentBaseRate
denominator
isoNumber
prefix
suffix
decimalPoint
decimalDigits
thousandsSeparator
}
}
language {
languageCode
name
default
}
}
}
Countries
To fulfil the countries list required for Checkout API, you can utilize the countries query.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
query Countries {
countries {
code
name
isEU
states {
code
name
}
defaultLanguage {
code
}
}
}
It doesn’t return pricelist, as in Checkout API
Languages
To fulfil the languages list required for Checkout API, you can use the languages query.
1
2
3
4
5
6
7
query Languages {
languages {
code
name
default
}
}
The selection part related to checkout stage is described in the Checkout documentation.