GetCart

Overview

This method of the Cart Service is designed to retrieve the contents of a shopping cart.

Request

Field Name

Data Type

Description

accountID

string

A unique identifier representing the ChannelAdvisor account you wish to access.

cartID

int

A cart that you want to retrieve.

Here is an example of a Request.  Note the CartID is already listed.  This is important because you if you are using this Service and you already have a specified number for a CartID, you can put the number of the CardID you want to GET.


Example: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://api.channeladvisor.com/webservices/">
   <soapenv:Header>
      <web:APICredentials>
         <!--Optional:-->
         <web:DeveloperKey>---</web:DeveloperKey>
         <!--Optional:-->
         <web:Password>---</web:Password>
      </web:APICredentials>
   </soapenv:Header>
   <soapenv:Body>
      <web:GetCart>
         <!--Optional:-->
         <web:accountID>---</web:accountID>
         <web:cartID>9170975</web:cartID>
      </web:GetCart>
   </soapenv:Body>
</soapenv:Envelope>

Response

Field Name

Data Type

Description

GetCartResult

APIResult<Cart>

This method returns a type named APIResultOfCart. See more information on APIResult. The cart information returned by this method will be contained in the ResultData field.


Here is an Example of the Response from the GetCart Request.  Note that ths is a successful reponse where the Cart was actually retrieved.  When the Cart is not retrieved, there is an general response sent back with an error message code to give appropriate feedback such as the CartID does not exist.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soap:Body>
      <GetCartResponse xmlns="http://api.channeladvisor.com/webservices/">
         <GetCartResult>
            <Status>Success</Status>
            <MessageCode>0</MessageCode>
            <ResultData>
               <CartID xmlns="http://api.channeladvisor.com/datacontracts/orders">9179406</CartID>
               <CheckoutURL xmlns="http://api.channeladvisor.com/datacontracts/orders">http://chnla.beta.channeladvisor.com/r.asp?p=12001097&amp;t=10584543&amp;i=9179406</CheckoutURL>
               <LineItemList xmlns="http://api.channeladvisor.com/datacontracts/orders">
                  <CartItem xsi:type="CartItemResponse">
                     <SKU>Disco Lights1</SKU>
                     <Title>Groovy Item</Title>
                     <LineItemID>140743</LineItemID>
                     <Quantity>2</Quantity>
                     <ItemSaleSource>DEMANDWARE_STORE</ItemSaleSource>
                     <UnitPrice>45.0000</UnitPrice>
                     <CurrencyCode>USD</CurrencyCode>
                     <UnitWeight UnitOfMeasure="LB">1</UnitWeight>
                  </CartItem>
               </LineItemList>
            </ResultData>
         </GetCartResult>
      </GetCartResponse>
   </soap:Body>
</soap:Envelope>

References