| Did this page help you? Yes No Tell us about it... |
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.
All locales.
| Name | Description | Required |
|---|---|---|
AssociateTag
|
Specifies the Associate who is making the request. An Associate tag, also known as an Associate ID, is an automatically generated unique identifier. When you log in to the Amazon Associates website for your locale, the page that you are directed to includes a message that says "Signed in as" followed by your Associate tag. The Associate tag that you used to create a cart must also be used on all other operations associated with the same cart. Type: String Default: None Valid Value: The same Associate tag that was used in the related CartCreate request. Constraint: | Yes |
CartId
|
Alphanumeric token returned by 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
|
This parameter is deprecated. When a customer purchases items in a remote shopping cart, the items are added to the customer’s Amazon retail shopping cart. | Deprecated |
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.
| Name | Description |
|---|---|
Cart
| Container for remote shopping cart related response elements. |
| 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
Remove all items from a specified cart:
http://webservices.amazon.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, you must supply it in this request.
The response to this request is shown in, Response to Sample Request.
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>