Overview
A method of the Cart Service which creates a new shopping cart.
Think of an actual Shopping Cart when you are shopping online. You can use the same Cart and add more items to the cart. You can choose to Create a cart with 1 Sku, 2 SKUs, or even more; however the stuff you are buying online must actually exist in the online store. The same type of behavior is expected from the CreateCart service.
Request
| Field Name |
Data Type | Description |
|---|---|---|
| accountID | string |
A unique identifier representing the ChannelAdvisor account you wish to access. |
| BuyerEmail | string | This is the buyer email address. Contraints exist as to the format of the Email address such as string length. |
| buyerEmail | string | E-mail of the buyer you wish to create an cart for. |
| lineItem | CartItemRequest[] | An array of items to place in the shopping cart after it is created. |
| SKU | string | This must be an existing SKU in the account which matches the accountID. If the SKU does not match, MessageCode 113 appears with "The specified SKU does not exist for this seller" |
| Title | string | Title of the SKU |
| Quantity | Integer | Must be 1 or more. If you specify 0, an Error message is expected "The requested cart could not be found." |
| LineItemID | integer | This is required to have an integer value. This is a place holder for what will be the CartID. Use the CartID to retrieve the Cart. The CartID value will also be used to translate the Cart into an Order (default behavior). When this transition occurs from Cart to Order, you can optionally specify a different OrderIDNumber other than the CartID. |
| ItemSaleSource | enumeration | This value must be specified to follow the list for SiteToken (See definition below) |
| UnitPrice | Currency | The integer value submitted will retain a value with 4 decimal places (45.0000) |
In the example below, please note that somefields values are still required but have been removed for this sample ([DeveloperKey], [Password],[accountID])
Example of SOAP Request for CreateCart
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://api.channeladvisor.com/webservices/" xmlns:ord="http://api.channeladvisor.com/datacontracts/orders">
<soapenv:Header>
<web:APICredentials>
<!-Optional:->
<web:DeveloperKey> --- </web:DeveloperKey>
<!-Optional:->
<web:Password> --- </web:Password>
</web:APICredentials>
</soapenv:Header>
<soapenv:Body>
<web:CreateCart>
<!-Optional:->
<web:accountID> --- </web:accountID>
<!-Optional:->
<web:buyerEmail>JamesJ@channeladvisor.com</web:buyerEmail>
<!-Optional:->
<web:lineItem>
<!-Zero or more repetitions:->
<web:CartItemRequest>
<!-Optional:->
<ord:SKU>Disco Lights1</ord:SKU>
<!-Optional:->
<ord:Title>Groovy Item</ord:Title>
<ord:LineItemID>0</ord:LineItemID>
<ord:Quantity>2</ord:Quantity>
<ord:ItemSaleSource>DEMANDWARE_STORE</ord:ItemSaleSource>
<ord:UnitPrice>45.00</ord:UnitPrice>
<ord:AllowNegativeQuantity>true</ord:AllowNegativeQuantity>
</web:CartItemRequest>
</web:lineItem>
</web:CreateCart>
</soapenv:Body>
</soapenv:Envelope>
Response
| Field Name |
Data Type | Description |
|---|---|---|
| CreateCartResult | 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. |
| CurrencyCode | string | Return value based on account settings |
| UnitWeight UnitOfMeasure | integer | Return value based on account settings |
Example Response from CreateCart
<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>
<CreateCartResponse xmlns="http://api.channeladvisor.com/webservices/">
<CreateCartResult>
<Status>Success</Status>
<MessageCode>0</MessageCode>
<ResultData>
<CartID xmlns="http://api.channeladvisor.com/datacontracts/orders">9179469</CartID>
<CheckoutURL xmlns="http://api.channeladvisor.com/datacontracts/orders">http://chnla.beta.channeladvisor.com/r.asp?p=12001097&t=10584732&i=9179469
</CheckoutURL>
<LineItemList xmlns="http://api.channeladvisor.com/datacontracts/orders">
<CartItem xsi:type="CartItemResponse">
<SKU>Disco Lights1</SKU>
<Title>Groovy Item</Title>
<LineItemID>140750</LineItemID>
<Quantity>2</Quantity>
<ItemSaleSource>DEMANDWARE_STORE</ItemSaleSource>
<UnitPrice>45.0000</UnitPrice>
<CurrencyCode>USD</CurrencyCode>
<UnitWeight UnitOfMeasure="LB">1</UnitWeight>
</CartItem>
</LineItemList>
</ResultData>
</CreateCartResult>
</CreateCartResponse>
</soap:Body>
</soap:Envelope>
SiteToken
<s:simpleType name="SiteToken">
<s:restriction base="s:string">
<s:enumeration value="UNKNOWN"/>
<s:enumeration value="EBAY_US"/>
<s:enumeration value="AMAZON_AUCTIONS"/>
<s:enumeration value="YAHOO"/>
<s:enumeration value="EBAY_MOTORS"/>
<s:enumeration value="EBAY_MOTORS_FIXED_PRICE"/>
<s:enumeration value="EBAY_STORES"/>
<s:enumeration value="EBAY_CA"/>
<s:enumeration value="EBAY_DE"/>
<s:enumeration value="EBAY_FR"/>
<s:enumeration value="EBAY_UK"/>
<s:enumeration value="EBAY_AU"/>
<s:enumeration value="DIRECT_SALE"/>
<s:enumeration value="EBAY_ES"/>
<s:enumeration value="EBAY_IT"/>
<s:enumeration value="CHANNELADVISOR_STORE"/>
<s:enumeration value="OVERSTOCK"/>
<s:enumeration value="EBAY_IE"/>
<s:enumeration value="DEMANDWARE_STORE"/>
</s:restriction>
Request with 2 SKUs
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://api.channeladvisor.com/webservices/" xmlns:ord="http://api.channeladvisor.com/datacontracts/orders">
<soapenv:Header>
<web:APICredentials>
<!-Optional:->
<web:DeveloperKey> XXX </web:DeveloperKey>
<!-Optional:->
<web:Password> XXX </web:Password>
</web:APICredentials>
</soapenv:Header>
<soapenv:Body>
<web:CreateCart>
<!-Optional:->
<web:accountID> XXX </web:accountID>
<!-Optional:->
<web:buyerEmail>James@channeladvisor.com</web:buyerEmail>
<!-Optional:->
<web:lineItem>
<!-Zero or more repetitions:->
<web:CartItemRequest>
<!-Optional:->
<ord:SKU>Disco Lights1</ord:SKU>
<!-Optional:->
<ord:Title>Groovy Item</ord:Title>
<ord:LineItemID>0</ord:LineItemID>
<ord:Quantity>2</ord:Quantity>
<ord:ItemSaleSource>DEMANDWARE_STORE</ord:ItemSaleSource>
<ord:UnitPrice>45.00</ord:UnitPrice>
<ord:AllowNegativeQuantity>true</ord:AllowNegativeQuantity>
</web:CartItemRequest>
<web:CartItemRequest>
<!-Optional:->
<ord:SKU>Disco Lights2</ord:SKU>
<!-Optional:->
<ord:Title>Groovy Item</ord:Title>
<ord:LineItemID>0</ord:LineItemID>
<ord:Quantity>3</ord:Quantity>
<ord:ItemSaleSource>DEMANDWARE_STORE</ord:ItemSaleSource>
<ord:UnitPrice>4.00</ord:UnitPrice>
<ord:AllowNegativeQuantity>true</ord:AllowNegativeQuantity>
</web:CartItemRequest>
</web:lineItem>
</web:CreateCart>
</soapenv:Body>
</soapenv:Envelope>
Response with 2 SKUs
<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>
<CreateCartResponse xmlns="http://api.channeladvisor.com/webservices/">
<CreateCartResult>
<Status>Success</Status>
<MessageCode>0</MessageCode>
<ResultData>
<CartID xmlns="http://api.channeladvisor.com/datacontracts/orders">9179487</CartID>
<CheckoutURL xmlns="http://api.channeladvisor.com/datacontracts/orders">http://chnla.beta.channeladvisor.com/r.asp?p=12001097&t=10584786&i=9179487
</CheckoutURL>
<LineItemList xmlns="http://api.channeladvisor.com/datacontracts/orders">
<CartItem xsi:type="CartItemResponse">
<SKU>Disco Lights1</SKU>
<Title>Groovy Item</Title>
<LineItemID>140756</LineItemID>
<Quantity>2</Quantity>
<ItemSaleSource>DEMANDWARE_STORE</ItemSaleSource>
<UnitPrice>45.0000</UnitPrice>
<CurrencyCode>USD</CurrencyCode>
<UnitWeight UnitOfMeasure="LB">1</UnitWeight>
</CartItem>
<CartItem xsi:type="CartItemResponse">
<SKU>Disco Lights2</SKU>
<Title>Groovy Item</Title>
<LineItemID>140757</LineItemID>
<Quantity>3</Quantity>
<ItemSaleSource>DEMANDWARE_STORE</ItemSaleSource>
<UnitPrice>4.0000</UnitPrice>
<CurrencyCode>USD</CurrencyCode>
<UnitWeight UnitOfMeasure="LB">1</UnitWeight>
</CartItem>
</LineItemList>
</ResultData>
</CreateCartResult>
</CreateCartResponse>
</soap:Body>
</soap:Envelope>