Checkout data mapping for Google

Ask about this Page
Copy for AI
View as Markdown

Understand how Universal Commerce Protocol (UCP) checkout session data maps between Google's UCP and commercetools.

UCP checkout requests are translated from Google into commercetools Cart and Order operations. This page details the field-level mapping for the cart operations and for each phase of the checkout lifecycle.

Cart

For the behavior of the cart operations, see Cart.

Request mapping

When an agent sends a Create Cart or Update Cart request, the component creates a CartDraft or replaces the Line Items and buyer information of the existing Cart.
UCP fieldRelated commercetools fieldRemarks
request.line_items[*].item.idCartDraft.lineItems[*].sku
request.line_items[*].quantityCartDraft.lineItems[*].quantity
request.buyer.emailCartDraft.customerEmail
request.buyer.first_nameCartDraft.billingAddress.firstName
request.buyer.last_nameCartDraft.billingAddress.lastName
request.buyer.phone_numberCartDraft.billingAddress.phone
request.context.languageNot applicableLocalizes the Line Item names in the response. The Cart is stored in the Store's language.
request.context.currencyNot applicableThe Store currency is used. A different currency is refused on create and ignored on update.
Not applicableCartDraft.currencySpecified by the Store configuration.
Not applicableCartDraft.countryDerived from the Store configuration.
Not applicableCartDraft.storeSpecified by the component configuration.
Not applicableCartDraft.lineItems[*].distributionChannelSpecified by the component configuration.
Not applicableCartDraft.lineItems[*].supplyChannelSpecified by the component configuration.

Response mapping

The Create, Get, Update, and Cancel Cart operations return a response mapped from the Cart.
UCP fieldRelated commercetools fieldRemarks
idcart.id
currencycart.totalPrice.currencyCode
context.languageNot applicableThe language the response is localized in.
context.address_countrycart.shippingAddress.countryOnly when the Cart has a shipping address.
line_itemscart.lineItems
line_items[*].idcart.lineItems[*].key or cart.lineItems[*].idThe key, when the Line Item has one.
line_items[*].item.idcart.lineItems[*].variant.sku
line_items[*].item.titlecart.lineItems[*].name[<locale>]Falls back to the SKU when the name has no value in the language.
line_items[*].item.pricecart.lineItems[*].price.value.centAmountThe discounted price, when the price has a discount.
line_items[*].item.image_urlcart.lineItems[*].variant.images[0].urlFirst image from the Variant.
line_items[*].quantitycart.lineItems[*].quantity
buyer.first_namecart.billingAddress.firstName
buyer.last_namecart.billingAddress.lastName
buyer.emailcart.customerEmail
buyer.phone_numbercart.billingAddress.phone
expires_atcart.lastModifiedAt plus cart.deleteDaysAfterLastModificationOmitted when the Cart has no deletion window.
continue_urlcart.store.custom.fields.continueUrlIncluded only when the Store publishes a checkout URL.
links[*].urlcart.store.custom.fieldsRefer to link mapping. Included only when the Store publishes policy links.

Create Checkout Session

Request mapping

When Google sends a Create Checkout Session request, a CartDraft is created in commercetools.
UCP fieldRelated commercetools fieldRemarks
request.currencyCartDraft.currency
request.line_itemsCartDraft.lineItems[]
request.line_items[*].item.idCartDraft.lineItems[*].sku
request.line_items[*].quantityCartDraft.lineItems[*].quantity
request.buyer.first_nameCartDraft.billingAddress.firstName
request.buyer.last_nameCartDraft.billingAddress.lastName
request.buyer.emailCartDraft.customerEmail
request.buyer.phone_numberCartDraft.billingAddress.phone
request.payment.instrumentsCartDraft.storeSpecified by the component configuration.
Not applicableCartDraft.countryDerived from the Store configuration.
Not applicableCartDraft.lineItems[*].distributionChannelSpecified by the component configuration.
Not applicableCartDraft.lineItems[*].supplyChannelSpecified by the component configuration.
Not applicableCartDraft.lineItems[*].inventoryModeSpecified by the component configuration.
header.Idempotency-KeyCartDraft.key

Response mapping

The component returns a checkout session response mapped from the Cart.
UCP fieldRelated commercetools fieldRemarks
idcart.id
line_itemscart.lineItems
line_items[*].idcart.lineItems[*].variant.sku
line_items[*].item.idcart.lineItems[*].sku
line_items[*].item.titlecart.lineItems[*].name[<locale>]Localized line item name.
line_items[*].item.pricecart.lineItems[*].price.value.centAmount
line_items[*].item.image_urlcart.lineItems[*].variant.images[0].urlFirst image from the Variant.
line_items[*].quantitycart.lineItems[*].quantity
line_items[*].totalLine item amount calculationRefer to the line item total calculation logic.
buyer.first_namecart.billingAddress.firstName
buyer.last_namecart.billingAddress.lastName
buyer.emailcart.customerEmail
buyer.phone_numbercart.billingAddress.phone
statusNot applicableSet to "incomplete".
currencycart.totalPrice.currencyCode
links[*].urlcart.store.custom.fieldsRefer to link mapping.
expires_atNot applicableCurrent timestamp plus cart.store.custom.fields.expiryInHour.
continue_urlcart.store.custom.fields.continueUrl
payment.handlersUCP profileFetched from the UCP profile configuration.

Update Checkout Session

Request mapping

When Google sends an Update Checkout Session request, the component updates the existing Cart.
UCP fieldRelated commercetools fieldRemarks
request.idcart.id
request.currencyCartDraft.currency
request.line_itemsCartDraft.lineItems[]
request.line_items[*].item.idCartDraft.lineItems[*].sku
request.line_items[*].quantityCartDraft.lineItems[*].quantity
request.buyer.first_namecart.billingAddress.firstName
request.buyer.last_namecart.billingAddress.lastName
request.buyer.full_namecart.billingAddress.firstName and cart.billingAddress.lastNameSplit into first and last name fields.
request.buyer.emailcart.customerEmail
request.buyer.phone_numbercart.billingAddress.phone
request.fulfillment.methods[*].destinations[*].postal_codecart.shippingAddress.postalCode
request.fulfillment.methods[*].destinations[*].countrycart.shippingAddress.country
request.fulfillment.methods[*].destinations[*].address_regioncart.shippingAddress.state
header.Idempotency-KeyCartDraft.key

Response mapping

The updated checkout session response is mapped from the updated Cart.

UCP fieldRelated commercetools fieldRemarks
idcart.id
line_itemscart.lineItemsSame mapping as Create response.
buyer.first_namecart.billingAddress.firstName
buyer.last_namecart.billingAddress.lastName
buyer.emailcart.customerEmail
buyer.phone_numbercart.billingAddress.phone
statusNot applicableSet to "ready_for_payment".
currencycart.totalPrice.currencyCode
expires_atNot applicableCurrent timestamp plus cart.store.custom.fields.expiryInHour.
continue_urlcart.store.custom.fields.continueUrl
payment.handlersUCP profileFetched from the UCP profile configuration.

Complete Checkout Session

Request mapping

When Google sends a Complete Checkout Session request with the Google Pay payment token, it authorizes payment and creates an Order.
UCP fieldRelated commercetools fieldRemarks
payment_data.billing_address.street_addresscart.billingAddress.streetName and cart.billingAddress.streetNumber
payment_data.billing_address.address_localitycart.billingAddress.city
payment_data.billing_address.address_regioncart.billingAddress.state
payment_data.billing_address.address_countrycart.billingAddress.country

Response mapping

The completed checkout session response is mapped from the created Order.

UCP fieldRelated commercetools fieldRemarks
idcart.id
line_itemsorder.lineItems
line_items[*].idorder.lineItems[*].variant.sku
line_items[*].item.idorder.lineItems[*].sku
line_items[*].item.titleorder.lineItems[*].name.en
line_items[*].item.priceorder.lineItems[*].price.value.centAmount
line_items[*].item.image_urlorder.lineItems[*].variant.images[0].url
line_items[*].quantityorder.lineItems[*].quantity
line_items[*].totalOrder line item amount calculation
buyer.first_nameorder.billingAddress.firstName
buyer.last_nameorder.billingAddress.lastName
buyer.emailorder.customerEmail
buyer.phone_numberorder.billingAddress.phone
statusNot applicableSet to "completed".
currencycart.totalPrice.currencyCode