Customer
Last updatedThe DTC API covers all the customer management features you get with the Checkout API and Shop API (excluding the wishlist). The documentation links each endpoint to the corresponding DTC API query or mutation and highlights any differences you need to consider during the migration process.
Update customer#
The DTC API offers a generic updateCustomer
mutation for customer update actions. In order to update the customer details, the shopper needs to be logged in.
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Update customer address | PUT /address | PUT /customers/{email} | updateCustomer |
Update customer | PUT /customer/update | PUT /customers/{email} | updateCustomer |
Change password | PUT /password | PUT /customers/{email} | updateCustomer |
Change email | PUT /email | PUT /customers/{email} | updateCustomer |
Update customer address#
Update the registered address for the logged-in customer.
1
2
3
4
5
6
7
8
9
10
mutation UpdateCustomerAddress($address: CustomerUpdateAddressInput!) {
updateCustomer(input: { billingAddress: $address }) {
customer {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
updateCustomer.customer
Update customer#
Update information for the currently logged in customer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mutation UpdateCustomer(
$address: CustomerUpdateAddressInput!
$gender: Gender
$consents: [ConsentInput!]
$customAttributes: CustomAttributeInput
) {
updateCustomer(
input: {
billingAddress: $address
gender: $gender
consents: $consents
customAttributes: $customAttributes
}
) {
customer {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
In comparison to the Checkout API or Shop API, where attributes are passed alongside other request body fields, the DTC API accepts them as the 'customAttributes' mutation parameter. For mapped custom attributes, you need to provide the attribute type name and ID for the chosen attribute. For dynamic attributes, you need to provide the attribute type name, attribute element key, and a value to assign.
1
2
3
4
5
6
7
8
9
10
customAttributes: {
dynamicAttributes: [
{
attributeTypeName: "cus_preferences"
attributeElementKey: "box"
attributeElementValue: "none"
}
]
mappedAttributes: [{ attributeTypeName: "cus_diet", attributeId: 12 }]
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
updateCustomer.customer
Change password#
Change the login password.
1
2
3
4
5
6
7
8
9
10
mutation UpdateCustomerPassword($password: PasswordUpdateInput) {
updateCustomer(input: { password: $password }) {
customer {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
updateCustomer.customer
Update email#
Update the login email for the currently logged-in customer.
1
2
3
4
5
6
7
8
9
10
mutation UpdateCustomerEmail($newEmail: String!) {
updateCustomer(input: { billingAddress: { email: $newEmail } }) {
customer {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
updateCustomer.customer
Register, log in and log out#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Register customer | POST /register | POST /customers/{email} | registerCustomer |
Log in | POST /login/{email} | POST /customers/{email}/login | logout |
Log out | POST /logout | No matches | logout |
Log in#
Log in as the customer in the current session
1
2
3
4
5
6
7
8
9
10
mutation Login($email: String!, $password: String!) {
login(email: $email, password: $password) {
loggedIn {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
login.loggedIn
Log out#
Log out from the customer in the current session
1
2
3
4
5
6
7
8
9
10
mutation Logout {
logout {
session {
...sessionFields
}
selection {
...selectionFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Transform
logout.selection
Register customer#
Register customer. One the registration is complete, the session will run as the logged in user.
1
2
3
4
5
6
7
8
9
10
mutation RegisterCustomer($input: CustomerRegisterInput!) {
registerCustomer(input: $input) {
loggedIn {
...customerFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform
registerCustomer.loggedIn
Get customer data#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Customer | GET /customer | GET /customers/{email} GET /customers/{email}/registered/{registered} | customer |
Customer Orders | POST /orders | customer |
Get customer#
Get information for the currently logged in customer
1
2
3
4
5
query Customer {
customer {
...customerFields
}
}
Checkout API:
- Response Content: Customer
- Action Needed to Match: Transform customer
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform customer
Customer orders#
Get previous orders for the currently logged in customer
1
2
3
4
5
6
7
8
query CustomerOrders {
customer {
...customerFields
orders {
...orderFields
}
}
}
Checkout API:
- Response Content: Orders list and customer data
- Action Needed to Match: Transform
customer
andcustomer.orders
Subscription management#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Customer subscriptions | POST /customer/subscriptions | POST /customers/{email}/subscriptions | customer subscriptionContracts |
Add customer subscription | POST /customer/contracts/{contract}/subscription | POST /customers/{email}/contracts/{contract}/subscription | addSubscription |
Update subscription quantity | PUT /customer/contracts/{contract}/subscription/{subscription} | input | updateSubscriptionQuantity |
Change subscription address | PUT /subscription/address | PUT /subscription/address | changeSubscriptionContractAddress |
Change subscription interval | PUT /subscription/interval | PUT /subscription/interval | updateSubscriptionInterval |
Update subscription status | PUT /subscription/status | PUT /subscription/status | updateSubscriptionStatus |
Customer subscriptions#
Customer subscriptions for currently logged in user.
Option 1
1
2
3
4
5
6
7
query CustomerSubscriptions {
customer {
subscriptionContracts {
...subscriptionContractFields
}
}
}
Option 2
1
2
3
4
5
query CustomerSubscriptions {
subscriptionContracts {
...subscriptionContractFields
}
}
Checkout API:
- Response Content: Subscription contract list
- Action Needed to Match: Transform
customer.subscriptionContracts
orsubscriptionContracts
Shop API:
- Response Content: Subscription contract list
- Action Needed to Match: Transform
customer.subscriptionContracts
orsubscriptionContracts
Add customer subscription#
Allows adding a subscription to an existing contract.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mutation AddCustomerSubscription(
$item: String!
$contractId: Int!
$subscriptionPlanId: Int!
$quantity: Int!
$nextOrderDate: Date!
) {
addSubscription(
item: $item
contractId: $contractId
subscriptionPlanId: $subscriptionPlanId
quantity: $quantity
nextOrderDate: $nextOrderDate
) {
contract {
...subscriptionContractFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
addSubscription.contract
Shop API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
addSubscription.contract
Update subscription quantity#
Update subscription quantity.
1
2
3
4
5
6
7
8
9
10
mutation UpdateSubscriptionQuantity($id: Int!, $quantity: Int!) {
updateSubscriptionQuantity(subscriptionId: $id, quantity: $quantity) {
contract {
...subscriptionContractFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionQuantity.contract
Shop API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionQuantity.contract
Change subscription contract address#
Change the contract address for the logged in customer
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation ChangeSubscriptionContractAddress(
$id: Int!
$address: SubscriptionContractAddressInput!
) {
changeSubscriptionContractAddress(contractId: $id, address: $address) {
contract {
...subscriptionContractFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
changeSubscriptionContractAddress.contract
Shop API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
changeSubscriptionContractAddress.contract
Change subscription interval#
Change the interval for a subscription owned by the logged in customer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mutation UpdateSubscriptionInterval(
$subscriptionId: Int!
$subscriptionPlanId: Int!
) {
updateSubscriptionInterval(
subscriptionId: $subscriptionId
subscriptionPlanId: $subscriptionPlanId
) {
contract {
...subscriptionContractFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionInterval.contract
Shop API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionInterval.contract
Update subscription status#
Update subscription status.
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation UpdateSubscriptionStatus(
$subscriptionId: Int!
$status: SubscriptionStatus!
) {
updateSubscriptionStatus(subscriptionId: $subscriptionId, status: $status) {
contract {
...subscriptionContractFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionStatus.contract
Shop API:
- Response Content: Subscription contract
- Action Needed to Match: Transform
updateSubscriptionStatus.contract
Reset password flow#
The reset password flow consits of multiple steps, each detailed below.
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Send reset password email | POST /password-reset-email POST /password-reset-email/{email} | POST customers/{email}/password-reset-email | equestPasswordResetEmail |
Verify hashes | No matches | POST /customer-password-reset-check | verifyResetPasswordHashes |
Reset password | POST /password-reset | PUT /customers/{email} | resetPassword |
Send reset password email#
Send a password reset email to the registered email address
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation RequestResetPasswordEmail(
$email: String!
$resetPasswordExternalUrl: String!
) {
requestPasswordResetEmail(
email: $email
resetPasswordExternalUrl: $resetPasswordExternalUrl
) {
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: password reset email sent message
- Action Needed to Match: return password reset email sent if userErrors is an empty array
Check reset password link#
Verify that a password reset link is valid. Use this when the customer visits the password reset page.
1
2
3
4
5
6
7
8
mutation VerifyResetPasswordHashes($i: String!, $id: String!) {
verifyResetPasswordHashes(i: $i, id: $id) {
valid
userErrors {
...userErrorsFields
}
}
}
Shop API:
- Response Content: Customer
- Action Needed to Match: Check if
verifyResetPasswordHashes.valid
is true and display reset password form. It’s not possible to get customer data on until customer is logged in to DTC API.
Reset password#
Reset password using the link from the password reset email. Can automatically login the customer if the password reset was successful and loginOnSuccess
is true.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mutation VerifyResetPasswordHashes(
$password: String!
$confirmPassword: String!
$id: String!
$i: String!
$loginOnSuccess: Boolean
) {
resetPassword(
password: $password
confirmPassword: $confirmPassword
id: $id
i: $i
loginOnSuccess: $loginOnSuccess
) {
changed
session {
...sessionFields
}
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Selection
- Action Needed to Match: Query selection and transform
Shop API:
- Response Content: Customer
- Action Needed to Match: Transform customer
Whishlist#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Customer wishlist | GET /customer/wishlists/{wishlist} | No matches | customer |
Add wishlist item | POST /customer/wishlists/{wishlist}/items/{displayItem} | No matches | No matches |
Remove wishlist item | DELETE /customer/wishlists/{wishlist}/items/{displayItem} | No matches | No matches |
Customer wishlist#
Customer wishlist for the currently logged in user.
1
2
3
4
5
6
7
query CustomerWishlist {
customer {
wishlists {
...wishlistFields
}
}
}
Checkout API:
- Response Content: Wishlist
- Action Needed to Match: Transform
customer.wishlists[0]
Add wishlist item#
Adding a wishlist item to wishlist, if wishlist doesn't exists, create it. Note: DTC API doesn’t support this functionality yet.
Remove wishlist item#
Remove wishlist item based on display item from the wishlist Note: DTC API doesn’t support this functionality yet.
Product and newsletter subscriptions#
Action | Checkout API | Shop API | DTC API |
---|---|---|---|
Subscribe to back in stock | POST /back-in-stock-subscription | POST /customers/{email}/back-in-stock-subscription | subscribeToBackInStock |
Subscribe to newsletter | POST /newsletter-subscription``POST /newsletter-subscription/{email} | POST /customers/{email}/newsletter-subscription | subscribeToNewsletter |
Back in stock subscription#
Subscribe to back in stock notification
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mutation SubscribeToBackInStock($input: BackInStockSubscribeInput!) {
subscribeToBackInStock(input: $input) {
subscribed
userErrors {
...userErrorsFields
}
}
}
Example input:
```gql
{
"input": {
"email": "example@centra.com",
"shipTo": {
"countryCode": "SE"
},
"item": "1-1",
"languageCode": "en"
}
}
Checkout API:
- Response Content: Empty response body
- Action Needed to Match: Check if
subscribeToBackInStock.userErrors
is an empty array
Shop API:
- Response Content: Empty response body
- Action Needed to Match: Check if
subscribeToBackInStock.userErrors
is an empty array
Subscribe to newsletter#
Subscribe to the newsletter using the provided email address.
1
2
3
4
5
6
7
8
9
10
11
mutation SubscribeToNewsletter(
$email: String!
$additionalInfo: NewsletterSubscribeInput!
) {
subscribeToNewsletter(email: $email, additionalInfo: $additionalInfo) {
subscribed
userErrors {
...userErrorsFields
}
}
}
Checkout API:
- Response Content: Flag if subscribed successfully
- Action Needed to Match: Use
subscribedToNewsletter.subscribed
for subscribed
Shop API:
- Response Content: “subscribed” as response body
- Action Needed to Match: Use
subscribedToNewsletter.subscribed
to detect a successful subscription
Type transformation#
Customer type#
The DTC API Customer type can be transformed into the format returned in the Checkout API or Shop API. To have all the necessary information, you need to include the following fields.
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
fragment customerFields on Customer {
id
email
firstName
lastName
billingAddress {
address1
address2
zipCode
city
state {
code
}
country {
code
}
}
gender
phoneNumber
language {
code
}
newsletterSubscriptions {
isActive
country {
code
}
}
attributes {
...atributeFields
}
}
fragment atributeFields on Attribute {
type {
name
}
... on MappedAttribute {
id
}
elements {
key
kind
... on AttributeChoiceElement {
value {
name
value
}
values {
name
value
}
}
... on AttributeImageElement {
url
width
height
mimeType
}
... on AttributeFileElement {
url
}
... on AttributeStringElement {
value
translations {
language {
name
}
value
}
}
}
}
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
{
"data": {
"customer": {
"id": 66,
"email": "example@centra.com",
"firstName": "Daniel",
"lastName": "Ford",
"billingAddress": {
"address1": "17 Downing Street",
"address2": null,
"zipCode": "SW1A 2AH",
"city": "London",
"state": null,
"country": {
"code": "SE"
}
},
"gender": "MALE",
"phoneNumber": "777888999",
"language": {
"code": "en"
},
"newsletterSubscriptions": [],
"attributes": [
{
"type": {
"name": "cus_diet"
},
"elements": [
{
"key": "diet",
"kind": "INPUT",
"value": "none",
"translations": null
}
]
}
]
}
},
"extensions": {
"token": "40cbec7f-fdba-487f-829e-d5e4f7640691",
"traceId": "f975419f85cd14c651f142926ee43340"
}
}
Checkout API response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"token": "e624d8be97f8d4c77f522a8c0247e11c",
"customer": "66",
"email": "example@centra.com",
"firstName": "Daniel",
"lastName": "Ford",
"gender": "M",
"address1": "17 Downing Street",
"address2": "",
"zipCode": "SW1A 2AH",
"city": "London",
"state": "",
"country": "SE",
"phoneNumber": "777888999",
"language": "en",
"newsletter": false,
"cus_diet_diet": "none"
}
"newsletter": false
can be simulated by checking if customer.newsletterSubscriptions
is an empty array.
To expose Customer.gender
in an API using Session mode scopes in the DTC API plugin, select it as an option. Note that the gender format in DTC API differs from Checkout API and requires mapping.
Checkout API | DTC API |
---|---|
M | MALE |
F | FEMALE |
X | UNKOWN |
All attributes are exposed in the same format throughout the DTC API. To align them with the Checkout API format, follow the attribute transformation rules.
Shop API response#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"email": "example@centra.com",
"firstName": "Daniel",
"lastName": "Ford",
"address1": "17 Downing Street",
"address2": "",
"zipCode": "SW1A 2AH",
"city": "London",
"state": "",
"country": "SE",
"phoneNumber": "777888999",
"gender": "male",
"registered": true,
"selection": null,
"cus_diet_diet": "none"
}
Only registered customers can log in through DTC API; hence, you need to hardcode "registered": true during customer transformation.
To expose Customer.gender in an API using Session mode scopes in the DTC API plugin, select it as an option. Note that the gender format in DTC API differs from Shop API and requires mapping.
Checkout API | DTC API |
---|---|
M | MALE |
F | FEMALE |
UNKOWN |
All attributes are exposed in the same format throughout the DTC API. To align them with the Checkout API format, follow the attribute transformation rules.
Subscription contract type#
The DTC API SubscriptionContract
type can be transformed into the format returned in the Checkout API or Shop API. To have all the necessary information, you need to include the following fields.
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
fragment subscriptionContractFields on SubscriptionContract {
id
createdAt
updatedAt
market {
id
}
pricelist {
id
}
originatingOrder {
number
}
shippingAddress {
firstName
lastName
email
phoneNumber
address1
address2
zipCode
city
state {
name
}
country {
name
}
}
subscriptions {
id
plan {
id
name
interval {
value
type
}
discount
}
createdAt
updatedAt
status
interval {
value
type
}
nextOrderDate
nextRetryDate
attentionReasons
lines {
...subscriptionLineFields
}
}
shippingOption {
name
price {
value
formattedValue
}
}
subscriptionPayment {
paymentMethod
status
createdAt
updatedAt
}
}
DTC API 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
{
"data": {
"subscriptionContracts": [
{
"id": 7,
"createdAt": "2024-03-05T15:31:01+01:00",
"updatedAt": "2024-03-05T15:31:01+01:00",
"market": {
"id": 1
},
"pricelist": {
"id": 19
},
"originatingOrder": {
"number": 580
},
"shippingAddress": {
"firstName": "Daniel",
"lastName": "Ford",
"email": "example@centra.com",
"phoneNumber": "777888999",
"address1": "17 Downing Street",
"address2": null,
"zipCode": "SW1A 2AH",
"city": "London",
"state": null,
"country": {
"name": "United Kingdom"
}
},
"subscriptions": [
{
"id": 6,
"plan": {
"id": 1,
"name": "1 month subscription",
"interval": {
"value": 1,
"type": "MONTH"
},
"discount": 0
},
"createdAt": "2024-03-05T15:31:01+01:00",
"updatedAt": "2024-03-05T15:31:01+01:00",
"status": "ACTIVE",
"interval": {
"value": 1,
"type": "MONTH"
},
"nextOrderDate": "2024-04-05",
"nextRetryDate": "2024-04-05",
"attentionReasons": [],
"lines": [
#lines content
]
}
],
"shippingOption": {
"name": "SEK",
"price": {
"value": 10,
"formattedPrice": "10.00 SEK"
}
},
"subscriptionPayment": [
{
"paymentMethod": "pay_dummy",
"status": "ACTIVE",
"createdAt": "2024-03-05T15:31:01+01:00",
"updatedAt": "2024-03-05T15:31:01+01:00"
}
]
}
]
},
"extensions": {
"token": "40cbec7f-fdba-487f-829e-d5e4f7640691",
"traceId": "1feb023df09e28ef18658915f3c16ca8"
}
}
Checkout API 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
{
"token": "20ebed2b25bcb05419a86aa847f91eca",
"contracts": [
{
"contract": 7,
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01",
"originatingOrder": 580,
"shippingAddress": {
"firstName": "Daniel",
"lastName": "Ford",
"email": "example@centra.com",
"phoneNumber": "777888999",
"address1": "17 Downing Street",
"address2": "",
"zipCode": "SW1A 2AH",
"city": "London",
"state": "",
"country": "United Kingdom"
},
"subscriptionPayment": {
"description": "1. FIRST (pay_dummy)",
"status": "active",
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01"
},
"shippingMethod": {
"shippingMethod": "sek",
"name": "SEK",
"predictedPrice": "10.00 SEK",
"predictedPriceAsNumber": 10
},
"subscriptions": [
{
"subscription": 6,
"subscriptionPlan": {
"subscriptionPlan": 1,
"name": "",
"intervalValue": 1,
"intervalType": "month",
"discountPercent": 0
},
"contract": 7,
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01",
"status": "active",
"interval": {
"type": "month",
"value": 1
},
"nextScheduledOrder": "2024-04-05",
"nextAttemptedOrder": "2024-04-05",
"attentionFlags": {
"paymentDeclined": false,
"paymentRevoked": false,
"outOfStock": false
},
"item": {
#item content
}
}
]
}
]
}
Shop API 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
{
"contracts": [
{
"contract": 7,
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01",
"originatingOrder": 580,
"shippingAddress": {
"firstName": "Daniel",
"lastName": "Ford",
"email": "example@centra.com",
"phoneNumber": "777888999",
"address1": "17 Downing Street",
"address2": "",
"zipCode": "SW1A 2AH",
"city": "London",
"state": "",
"country": "United Kingdom",
},
"subscriptionPayment": {
"description": "1. FIRST (pay_dummy)",
"status": "active",
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01"
},
"shippingMethod": {
"shippingMethod": "sek",
"name": "SEK",
"predictedPrice": "10.00 SEK",
"predictedPriceAsNumber": 10
},
"market": 1,
"pricelist": 19,
"subscriptions": [
{
"subscription": 6,
"subscriptionPlan": {
"subscriptionPlan": 1,
"name": "",
"intervalValue": 1,
"intervalType": "month",
"discountPercent": 0
},
"contract": 7,
"created": "2024-03-05 15:31:01",
"updated": "2024-03-05 15:31:01",
"status": "active",
"interval": {
"type": "month",
"value": 1
},
"nextScheduledOrder": "2024-04-05",
"nextAttemptedOrder": "2024-04-05",
"attentionFlags": {
"paymentDeclined": false,
"paymentRevoked": false,
"outOfStock": false
},
"item": {
#item content
}
}
]
}
]
}
The DTC API interval type format differs from Checkout API and needs to be mapped or casted to lowercase.
Checkout API | Shop API | DTC API |
---|---|---|
day | day | DAY |
week | week | WEEK |
month | month | MONTH |
year | year | YEAR |
Attention flags are provided as an array of applied flags. Check for the presence of PAYMENT_DECLINED
, PAYMENT_REVOKED
, and OUT_OF_STOCK
. If any of these flags are returned, set the corresponding field in the attentionFlags to true during transformation.