CartGet
Description
Because the contents of a cart can change for different reasons, such as availability,
you should not keep a copy of a cart locally. Instead, use CartGet
to
retrieve the items in a remote shopping cart.
To retrieve the items in a cart, you must specify the cart using the CartId
and HMAC
values, which are returned in the
CartCreate
operation. A value similar to HMAC, URLEncodedHMAC
, is also returned. This value is the URL encoded version of the
HMAC
. This encoding is necessary because some characters, such as +
and /, cannot be included in a URL. Rather than encoding the HMAC
yourself, use the URLEncodedHMAC
value for the HMAC
parameter.
CartGet
does not work after the customer has used the PurchaseURL
to either purchase the items or merge them with the items in their
Amazon cart.
If the associated
CartCreate
request specified an AssociateTag
, all CartGet
requests must also include a value for AssociateTag
otherwise the request will fail.
Availability
All locales.
Request Parameters
Name | Description | Required |
---|---|---|
AssociateTag
|
Alphanumeric token that uniquely identifies an Associate. This value is required
only if the cart was created using an Type: String Default: None Valid Values: A valid Constraint: If you create a cart using your AssociateTag, you must include it in all future requests related to that shopping cart. |
Conditional |
CartId
|
Alphanumeric token returned by Type: String Default: None Valid Values: Value returned by |
Yes |
CartItemId
|
Alphanumeric token that uniquely identifies an item in a cart. Once an item,
specified by an ASIN or OfferListingId, has been added to a cart, you must use the
Type: String Default: None Valid Values: Value returned by |
Yes |
HMAC
|
The Hash Message Authentication Code is an encrypted alphanumeric token that is used to authenticate requests. Type: String Default: None Valid Values: Value is calculated using request parameters, their values, a cryptographic function, and the Secret Key, which acts as the "key" for the function. |
Yes |
MergeCart
|
A boolean value that when True specifies that the items in a customer's remote shopping cart are added to the customer’s Amazon retail shopping cart. This occurs when the customer elects to purchase the items in their remote shopping cart. When the value is False (the default) the remote shopping cart contents are not added to the retail shopping cart. Instead, the customer is sent directly to the Order Pipeline when they elect to purchase the items in their cart. This parameter is valid only in the US locale. In all other locales, the parameter is invalid but the request behaves as though the value were set to True. Type: String Default: False (in US) Valid Values: True | False |
No |
ResponseGroup
|
Specifies the types of values to return. You can specify multiple response groups in one request by separating them with commas. Type: String Default: Cart Valid Values: CartSimilarities | CartTopSellers | CartNewReleases |
No |
CartGet
also accepts the parameters that all operations can use. For more
information, see, Common Request Parameters
Response
Name | Description |
---|---|
Amount
|
Price of the item in terms of the lowest currency denomination, for example, pennies. |
CartId
|
Alphanumeric token returned by CartCreate that identifies a
cart. |
CartItem
|
Container for CartItemId, ASIN, MerchantId, SellerId, SellerNickname, Quantity, Title, ProductGroup, Price, ItemTotal |
CartItems
|
Container for Subtotal and CartItem |
CurrencyCode
|
Format for the display of the money |
FormattedPrice
|
The price to display on the web site. |
HMAC
|
Hash Message Authentication Code returned by CartCreate that
identifies a cart. This is an encrypted alphanumeric token that is used to
authenticate cart operations. |
ItemTotal
|
Container for Amount, CurrencyCode, FormattedPrice. Cost of the item multiplied by the quantity ordered. |
Price
|
Container for Amount, CurrencyCode, FormattedPrice. Price of a single item. |
PurchaseURL
|
URL that customers should use to purchase the items in their cart. The URL
includes the Associate's ID, called the Associate Tag. It is important to use the
PurchaseURL otherwise the Associate will not get credit for the customer's
purchase. AssociateTag is an optional parameter in CartCreate but if you omit that parameter the CartCreate request, you must add the Associate's ID manually to the
PurchaseURL . |
Subtotal
|
Container for Amount, CurrencyCode, and FormattedPrice. Subtotal is the total price of all of the items in a car butt not including tax or shipping. |
URLEncodedHMAC
|
A URL encoded version of the HMAC . This encoding is
necessary because some characters, such as + and /, cannot be included in a URL. The
value of this parameter is a convenience function. Otherwise, you would have to URL
encode the HMAC yourself. |
For more information about the parent elements of these tags, see the appropriate response group in Response Groups
Examples
Retrieve all of the items in a specified cart:
http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=[AWS Access Key ID]
& AssociateTag=[Associate Tag]
& Operation=CartGet& CartId=[Cart ID]& HMAC=[URL-encoded HMAC]
This operation retrieves all of the items in the specified remote shopping cart. Because
the HMAC
potentially includes the AssociateTag
,
if you created the cart using AssociateTag
, you must supply it in this
request.
The response to this request is shown in, Response to Sample Request.
Sample Response
The following XML is a snippet of the full response to the first sample request.
<CartId>002-9918938-1696046</CartId> <HMAC>b0ogzvivVYLXjSZ9WwoBRFesFYU=</HMAC> <URLEncodedHMAC>b0ogzvivVYLXjSZ9WwoBRFesFYU=</URLEncodedHMAC> <PurchaseURL>https://www.amazon.com/gp/cart/aws-merge.html?cart-id=002-9918938-1696046%26associate-id=ws%26hmac=b0ogzvivVYLXjSZ9WwoBRFesFYU=%26AWSAccessKeyId=1V293857EXAMPLEFW9C02%26MergeCart=False</PurchaseURL> <SubTotal> <Amount>1994</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$19.94</FormattedPrice> </SubTotal> <CartItems> <SubTotal> <Amount>1994</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$19.94</FormattedPrice> </SubTotal> <CartItem> <CartItemId>U3KYV0C66V3PAA</CartItemId> <ASIN>B000062TU1</ASIN> <MerchantId>ATVPDKIKX0DER</MerchantId> <SellerId>A2R2RITDJNW1Q6</SellerId> <SellerNickname>Amazon.com, LLC</SellerNickname> <Quantity>2</Quantity> <Title>Harry Potter and the Sorcerer's Stone (Full Screen Edition) (Harry Potter 1)</Title> <ProductGroup>DVD</ProductGroup> <Price> <Amount>997</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$9.97</FormattedPrice> </Price> <ItemTotal> <Amount>1994</Amount> <CurrencyCode>USD</CurrencyCode> <FormattedPrice>$19.94</FormattedPrice> </ItemTotal> </CartItem> </CartItems> </Cart>
This response shows all of the items in the specified cart.