Skip to main content

Fetch the details of an active cart

Use the activeCartOfUser query to fetch the active cart of a user in a marketplace. It can be used at any point during the checkout process, such as, after adding items to a cart, removing items from a cart, and updating cart items, to fetch the latest cart data.

Query:

query activeCartOfUser($input: ActiveCartOfUserInput!) {
activeCartOfUser(input: $input) {
createdOn
currency
id
items {
id
edition {
id
code
name
}
product {
id
name
}
units {
quantity
unit
}
}
pricingTotal {
amountDueAfterTax
amountDueBeforeTax
shippingFeeAmount
recurringTotals {
totalSalePrice
totalSalePriceTaxIncluded
billingCycle {
dayOfMonth
period
}
}
taxSummary {
description
taxAmount
}
totalTaxAmount
}
}
}

Sample arguments:

 {
"input": {
"userId": "58dc8384-a60c-4a32-a949-80bf06cbc40a",
"accountId": "54df8520-2605-4b8f-96b7-f84adef2898a"
}
}

Sample output:

{
"data": {
"activeCartOfUser": {
"createdOn": "2023-09-25T12:28:08.000Z",
"currency": "USD",
"id": "65117cd8ce3df31e68af9446",
"items": [
{
"id": "8dff5f47-60ed-40cf-9c29-133a52cf3d86",
"edition": {
"id": "c424c2cc-ec60-4747-b347-3ac0dd41ddd3",
"code": "CFQ7TTC0LF8Q:0001",
"name": "Office 365 Enterprise E1"
},
"product": {
"id": "21cd2a44-213c-40bc-8d38-1c3117b4b7e4",
"name": "Office 365 for Enterprises"
},
"units": [
{
"quantity": 10,
"unit": "LICENSE"
}
]
}
],
"pricingTotal": {
"amountDueAfterTax": 90.51,
"amountDueBeforeTax": 84,
"shippingFeeAmount": null,
"recurringTotals": [],
"taxSummary": [
{
"description": "Flat Tax",
"taxAmount": 6.51
}
],
"totalTaxAmount": 6.51
}
}
},
}

Common errors

For information on some of the common errors related to this mutation, refer to the section on Error handling.

Was this page helpful?