CartClear

Description

The CartClear operation enables you to remove all of the items in a remote shopping cart, including SavedForLater items. To remove only some of the items in a cart or to reduce the quantity of one or more items, use CartModify .

To delete all of the items from a remote shopping cart, you must specify the cart using the CartId and HMAC values, which are returned by the CartCreate operation. A value similar to the 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.

CartClear 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.

Carts exist even though they have been emptied. The lifespan of a cart is 7 days since the last time it was acted upon. For example, if a cart created 6 days ago is modified, the cart lifespan is reset to 7 days.

Availability

All locales.

Request Parameters

NameDescriptionRequired
AssociateTag

Alphanumeric token that uniquely identifies an Associate. This value is required only if the cart was created using the AssociateTag.

Valid Values: Valid AssociateTag that was used in the related CartCreate request.

Depends
CartId

Alphanumeric token returned by CartCreate that identifies a cart.

Type: String

Default: None

Valid Values: Value returned by CartCreate.

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

No

CartClear also accepts the parameters that all operations can use. For more information, see, Common Request Parameters.

Response

NameDescription
Cart Container for remote shopping cart related response elements.
CartClearRequest Container for CartClear and HMAC.
CartId Alphanumeric token returned by CartCreate that uniquely identifies a cart.
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.
URLEncodedHMAC URL encoded version of the HMAC. This encoding is necessary because some characters, such as + and /, cannot be included in a URL.

For more information about the parent elements of these tags, see the appropriate response group in Response Groups

Examples

Remove all items from a specified cart:

http://ecs.amazonaws.com/onca/xml?
Service=AWSECommerceService&
AWSAccessKeyId=[AWS Access Key ID]&
AssociateTag=[Associate Tag]&
Operation=CartClear&
CartId=[Cart ID]&
HMAC=[URL-encoded HMAC]
&Timestamp=[YYYY-MM-DDThh:mm:ssZ]
&Signature=[Request Signature]

This operation removes all of the items in the specified cart. Because the HMAC 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.

<Cart>
  <Request>
    <IsValid>True</IsValid>
    <CartClearRequest>
      <CartId>102-2689399-8023324</CartId>
      <HMAC>iLYO/W0hft0Te4uXAbMiBhs36T8=</HMAC>
    </CartClearRequest>
  </Request>
  <CartId>102-2689399-8023324</CartId>
  <HMAC>iLYO/W0hft0Te4uXAbMiBhs36T8=</HMAC>
  <URLEncodedHMAC>iLYO/W0hft0Te4uXAbMiBhs36T8=</URLEncodedHMAC>
</Cart>  

Related Operations