Product Advertising API
Developer Guide (API Version 2011-08-01)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

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 and CartId values in a CartGet request.

    http://webservices.amazon.com/onca/xml?
    Service=AWSECommerceService&
    AWSAccessKeyId=[AWS Access Key ID]&
    AssociateTag=ws&
    Operation=CartGet&
    CartId=002-2041347-9034467&
    HMAC=[HMAC]
    
    &Timestamp=[YYYY-MM-DDThh:mm:ssZ]
    &Signature=[Request Signature]
    
                        

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]</PurchaseURL>
<CartItems>
  <SubTotal>
    <Amount>1994</Amount>
    <CurrencyCode>USD</CurrencyCode>
    <FormattedPrice>$19.94</FormattedPrice>
  </SubTotal>
  <CartItem>
    <CartItemId>U3KYV0C66V3PAA</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>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.