Retrieving the Contents of a Cart
You should not maintain a local copy of the remote shopping cart. Instead, use
CartGet
to retrieve the items in a shopping cart.
Retrieving the items in a cart
-
Use the cart's
HMAC
andCartId
values in aCartGet
request.http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService& AWSAccessKeyId=
[AWS Access Key ID]
& AssociateTag=ws& Operation=CartGet& CartId=002-2041347-9034467& HMAC=[HMAC]
By default,
CartGet
uses the Cart response group. This response group provides a lot of information
about items, including, for example, their price, quantity, and the seller ID of the
seller selling the item, as shown in the following response snippet.
<PurchaseURL>https://www.amazon.com/gp/cart/aws-merge.html?cart-id=002-9918938-1696046%26associate-id=ws%26hmac=b0ogzvivVYLXjSZ9WwoBRFesFYU=%26AWSAccessKeyId=[AWS Access Key ID]
MergeCart=False</PurchaseURL>
<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>
You could, for example, use the
CartItemId
in a
CartModify
operation to change the quantity of that item. You could also use the
PurchaseURL
to purchase the items in the cart.