Skip to main content

Get cart fields

Use the Cartfields query to fetch the definitions of certain attributes related to cart or cart items. These are either configured by the ISV or by the Marketplace Manager or both. It fetches 3 types of fields:

  • productFields
  • subscriptionCustomAttributes
  • purchaseCustomAttributes

These field definitions can be used to construct form fields so that necessary data can be captured.

Query:

query cartFields($cartId: ID!, $locale: Locale!) {
cartFields(cartId: $cartId, locale: $locale) {
productFields {
itemId
forms {
title
subTitle
fields {
fieldType
inputCode
inputTitle
tooltip
subTitle
validations {
expression
maxLength
minLength
readOnly
required
}
}
}
}
purchaseCustomAttributes {
fieldType
inputCode
inputTitle
tooltip
subTitle
validations {
expression
maxLength
minLength
readOnly
required
}
}
subscriptionCustomAttributes {
fieldType
inputCode
inputTitle
subTitle
tooltip
validations {
expression
maxLength
readOnly
required
minLength
}
} } }

Sample arguments

{
"cartId": "65117cd8ce3df31e68af9446",
"locale": "en-US"
}

Sample arguments

{
"input":{
"cartId": "95cce1ea-37fb-431d-9f5a-7df387b7e8e4",
"discountCode": "FLAT_50_OFF"
}
}

Sample output

{
"data": {
"cartFields": {
"productFields": [
{
"itemId": "8dff5f47-60ed-40cf-9c29-133a52cf3d86",
"forms": [
{
"title": "Additional Information",
"subTitle": "Additional information required by platform",
"fields":[
{
"fieldType": "TEXT",
"inputCode": "SubDomain",
"inputTitle": "Your Microsoft tenant name",
"tooltip": "The name of your Microsoft primary domain - otherwise known as tenant. This cannot be changed once provisioned, however you can change to a custom domain later.",
"subTitle": "",
"validations": {
"expression": "^[a-zA-Z0-9.]{1,}$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
{
"fieldType": "TEXT",
"inputCode": "UserPrincipleName",
"inputTitle": "Username",
"tooltip": "The username you will use to sign in to Office 365. A separate admin username will be provisioned, per Microsoft requirements.",
"subTitle": "",
"validations": {
"expression": "^(?=.*[a-zA-Z0-9]{1,})(?!\\s*$)(?!\\b([a-zA-ZÀ-ǿ0-9!#$%&.'*/=?^_`{|}~-])\\1\\1+\\b)(?:[a-zA-ZÀ-ǿ0-9!#$%&.'*/=?^_`{|}~-]+(?:\\.[a-zA-ZÀ-ǿ0-9!#$%&.'*/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e\\x1f\\x21\\x23\\x5b\\x5d\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e\\x7f])*\")$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true,
"validationType": null
}
},
{
"fieldType": "EMAIL",
"inputCode": "AlternateEmail",
"inputTitle": "Alternate email address",
"tooltip": "An email address that you currently use. Your new Office 365 account information and notifications will be sent to it.",
"subTitle": "",
"validations": {
"expression": "^(?:[a-zA-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?!.*\\.microsoft.com|microsoft.com)(?:(?:[a-zA-z0-9](?:[a-zA-z0-9-]*[a-zA-z0-9])?\\.)+[a-zA-z0-9](?:[a-zA-z0-9-]*[a-zA-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-z0-9-]*[a-zA-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$",
"maxLength": 255,
"minLength": 2,
"readOnly": false,
"required": true
}
},
{
"fieldType": "TEXT",
"inputCode": "FirstName",
"inputTitle": "First name",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-zÀ-ǿ\\u0E00-\\u0E7F]+(((\\'|\\-|\\.(\\s)?|\\,(\\s)?|\\s)?([A-Za-zÀ-ǿ\\u0E00-\\u0E7F.'-])+))*$",
"maxLength": 255,
"minLength": 2,
"readOnly": false,
"required": true
}
},
"fieldType": "TEXT",
"inputCode": "LastName",
"inputTitle": "Last name",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-zÀ-ǿ\\u0E00-\\u0E7F]+(((\\'|\\-|\\.(\\s)?|\\,(\\s)?|\\s)?([A-Za-zÀ-ǿ\\u0E00-\\u0E7F.'-])+))*$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
{
"fieldType": "COUNTRY",
"inputCode": "Address/ISO3Country",
"inputTitle": "Country",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-z]{2}$",
"maxLength": 3,
"minLength": 2,
"readOnly": false,
"required": true
}
},
{
"fieldType": "TEXT",
"inputCode": "Address/Line1",
"inputTitle": "Address line 1",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-zÀ-ǿ0-9\\u0E00-\\u0E7F]+(((\\'|\\-|\\.|\\s)?([A-Za-zÀ-ǿ0-9\\u0E00-\\u0E7F.', -\\/])+))*(\\.)?$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
{
"fieldType": "TEXT",
"inputCode": "Address/City",
"inputTitle": "City",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-zÀ-ǿ\\u0E00-\\u0E7F]+(((\\'|\\-|\\.(\\s)?|\\,(\\s)?|\\s)?([A-Za-zÀ-ǿ\\u0E00-\\u0E7F.'-])+))*$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
{
"fieldType": "STATE",
"inputCode": "Address/State",
"inputTitle": "State",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[A-Za-zÀ-ǿ0-9\\u0E00-\\u0E7F]+(((\\'|\\-|\\.(\\s)?|\\,(\\s)?|\\s)?([A-Za-zÀ-ǿ0-9\\u0E00-\\u0E7F])+))*$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
{
"fieldType": "ZIP_CODE",
"inputCode": "Address/PostalCode",
"inputTitle": "ZIP/Postal code",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[a-zA-ZÀ-ǿ0-9]+([- \\s]?[a-zA-ZÀ-ǿ0-9])*$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true,
"validationType": null
}
},
{
"fieldType": "PHONE_NUMBER",
"inputCode": "Address/PhoneNumber",
"inputTitle": "Phone number",
"tooltip": "",
"subTitle": "",
"validations": {
"expression": "^[+]?[0-9]+([- ]?[0-9]+)*$",
"maxLength": 255,
"minLength": 1,
"readOnly": false,
"required": true
}
},
]
}
]
}
],
"purchaseCustomAttributes": [
{
"fieldType": "TEXT",
"inputCode": "testID",
"inputTitle": "Purchase Custom VO",
"tooltip": null,
"subTitle": "Enter value here",
"validations": {
"expression": null,
"maxLength": null,
"minLength": null,
"readOnly": false,
"required": false
}
}
],
"subscriptionCustomAttributes": [
{
"fieldType": "TEXT",
"inputCode": "testID",
"inputTitle": "subscription VO",
"subTitle": "",
"tooltip": null,
"validations": {
"expression": null,
"maxLength": null,
"readOnly": false,
"required": false,
"minLength": null
}
}
]
}
},
}

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?