Menu
Product Advertising API
Developer Guide (API Version 2013-08-01)

Using Values Returned by CartCreate in Other Cart Operations

The following XML is a snippet of the response to the CartCreate request.

Copy
<CartId>002 2197248 2529608</CartId> <HMAC>/WrekkZAPx782xttLFbZqviNUOA=</HMAC> <URLEncodedHMAC>%2FWrekkZAPx782xttLFbZqviNUOA%3D</URLEncodedHMAC> <PurchaseURL>https://www.amazon.com/gp/cart/aws merge.html?cart id=002 2197248 2529608%26associate id=ws%26hmac=/WrekkZAPx782xttLFbZqviNUOA=%26AWSAccessKeyId=[AWS Access Key ID]</PurchaseURL> <SubTotal> <Amount>2998</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$29.98</FormattedPrice> </SubTotal> <CartItems> <SubTotal> <Amount>2998</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$29.98</FormattedPrice> </SubTotal> <CartItem> <CartItemId>UV3W10T4V7PCZ</CartItemId> <ASIN>B000062TU1</ASIN> <Quantity>2</Quantity> <Title>Harry Potter and the Sorcerer's Stone (Full Screen Edition) (Harry Potter 1)</Title> <ProductGroup>DVD</ProductGroup> <Price> <Amount>1499</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$14.99</FormattedPrice> </Price> <ItemTotal> <Amount>2998</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$29.98</FormattedPrice> </ItemTotal> </CartItem> </CartItems>

Many of the item attributes in the response are used in future cart requests. Those item attributes are explained in the following table.

Attribute Description
CartId An alphanumeric token that uniquely identifies a remote shopping cart. This value must accompany every cart operation associated with the newly created cart.

HMAC

Hash Message Authentication Code. This is an encrypted alphanumeric token used to authenticate requests. A URL-encoded version of this value must accompany every cart operation associated with the newly created cart. The alternative is to include, instead, the URLEncodedHMAC value.
URLEncodedHMAC

This is the HMAC value with all of the characters converted in to a URL-compliant form. Some HMAC characters, such as plus (+), are incompatible with URLs. This is a problem because the HMAC must be included in every cart operation and thus is part of the URL request. The URLEncodedHMAC value, then, is a convenience function that relieves developers of the need to create their own URL-encoded HMAC value. This value must accompany every cart operation.

Copy
<HMAC>Cw1g4IbVzOtzFkJR/zBj1GNnZMA</HMAC> <URLEncodedHMAC>Cw1g4IbVzOtzFkJR/zBj1GNnZMA </URLEncodedHMAC>
PurchaseURL

This is the URL that is submitted, like a request, to enter the Order Pipeline and purchase the items in a cart. PurchaseURL includes the Associate's Tag. It is important that this URL is used to make the purchase otherwise the Associate will not get credit for the sale.

Copy
<PurchaseURL>https://www.amazon.com/gp/cart/aws-merge.html?cart-id=102-9464231-2184159%26associate-id=ws%26hmac=Cw1g4IbVzOtzFkJR/zBj1GNnZMA=%26AWSAccessKeyId=1VEXAMPLE9C02</PurchaseURL>

CartItemId An alphanumeric token that uniquely identifies an item in the cart. Although the items added to a remote shopping cart using CartCreate were identified by an ASIN or OfferListingId, those items lose those associations. Instead, to refer to an item in a cart in future cart operation requests, you must use the item's CartItemId value.