Checkout data mapping for Google

Ask about this Page
Copy for LLM
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 each phase of the checkout lifecycle.

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