Cart API v3

The Cart REST-like API supports JSON and JSONP formats. All of the resources are described below. This API is not a strictly REST because it's been crafted to support JSONP.

JSONP Callback Parameter

In all requests, you may specific a callback parameter for JSONP responses. This parameter wraps your response in a callback method of your choice. For example, appending callback=cb to your request will result in a response body of: cb && cb(...). Callbacks may only contain alphanumeric characters and underscores; any invalid characters will be stripped.


New Cart

Returns a new, empty shopping cart.

Request format

http://api.shoppable.com/v3/cart

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Response object

Same as Get cart, refer to that response object.

Example response

{
  "cart": {
    "id": "22d71c39-28e3-4d2e-a4e8-dcbc2e3b5bfd",
    "qty": 0,
    "subtotal": 0
  }
}

Put item

Adds or updates an item (by SKU) to an existing shopping cart. You can get the SKU from the Product API.

Request format

http://api.shoppable.com/v3/cart/:id/put/:sku/qty/:qty/frame/:frame

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart/04ac3fc0-bca4-435b-94cf-4646889ed8e/put/1069-5d27a56d-165f-44ee-a6e3-9e666799666a_9dec3c470169aa430c98fd3f7806c9a8/qty/1/frame/1

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Request parameters

Parameter Type Description
id

REQUIRED

URL Param The Id of the requested shopping cart.
sku

REQUIRED

URL Param The SKU of the item you'd like to add to the shopping cart. The SKU must exist and must be active in order for the item to be added.
qty

REQUIRED

URL Param The quantity of the item you'd like to add to the shopping cart.
frame

REQUIRED

URL Param The Id of the frame from which this action was triggered.

Response object

Same as Get cart, refer to that response object.

Example response

Same as Get cart, refer to that example.

Get Cart

Returns the contents of an existing shopping cart.

Request format

http://api.shoppable.com/v3/cart/:id

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart/QTKjF6dJrYC3NOwE2498831069e1b964

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Request parameters

Parameter Type Description
id

REQUIRED

URL Param The Id of the requested shopping cart.

Response object

The response contains a JSON object with the following attributes:

Attribute Description
cart An object containing attributes for this shopping cart.
merchants An array of merchants whose items are in this shopping cart.

Cart object

The cart object will contain the following attributes.

Attribute Description
id A unique ID for this shopping cart.
qty The total number of items in this shopping cart. This number is a sum of quantities for each item in the cart.
subtotal The subtotal for this shopping cart.

Merchant object

Each merchant in the merchants array will contain the following attributes.

Attribute Description
id 72Lux's ID for this merchant.
name The merchant's name.
customer_service_url The merchant's customer service URL if one is set. If the customer_service_url is not set by the merchant, this attribute will be omitted.
ship_flat_rate The flat rate shipping fee for this merchant.
ship_free_min The merchant's minimum subtotal threshold for free shipping. If there is no minimum threshold for free shipping, this value will be omitted.
shipping_fee The current shipping fee for this merchant, based on the items in the cart.
items An array of items in the cart for this merchant.

Item object

Each item in the items array will contain the following attributes.

Attribute Description
sku 72Lux's unique SKU for this color/size variant of the product.
part_number 72Lux's part number for the product.
name The name.
brand The brand name.
qty The quantity for this item in the cart.
frame_id The ID of the frame where this item was added from.
color A string containing the color. This attribute will be omitted if the product doesn't come in different colors.
size A string containing the size. This attribute will be omitted if the product doesn't come in different sizes.
retail_price The retail price.
sale_price

OPTIONAL

The sale price. Only if there is sale.
discount_price The dicount price.
price The price of the item, populated with either the SKU's retail_price or sale_price depending on whether the item is discounted.
subtotal The subtotak of the item. Effectively: price * qty.
currency Unused for now, always set to 'USD'
merchant_item_id The merchant's item ID for the product if one is set. If the merchant_item_id is not set by the merchant, this attribute will be omitted.
merchant_sku The merchant's SKU for the current color/size combination if one is set. If the merchant_sku is not set by the merchant, this attribute will be omitted.
material The material the product is made from, if one is set. If the material is not set, this attribute will be omitted.
images An array of image URLs for this SKU. There will always be at least one.
category The category of the product, if one is set. If a category is not set, this attribute will be omitted. The category is formatted as "Level 1 category > Level 2 category > ..."

Example response

{
  "cart": {
    "id": "22d71c39-28e3-4d2e-a4e8-dcbc2e3b5bfd",
    "qty": 2,
    "subtotal": 121.49
  },
  "merchants": [
    {
      "id": 1032,
      "name": "Best Buy",
      "customer_service_url": "http://www.bestbuy.com/site/Global/Customer-Service/pcmcat87800050001.c?id=pcmcat87800050001",
      "return_policy_url": "http://www.bestbuy.com/site/Help-Topics/Returning-Online-Purchases/pcmcat260800050014.c?id=pcmcat260800050014",
      "ship_flat_rate": 0,
      "ship_free_min": 0,
      "subtotal": 19.99,
      "shipping_fee": 0,
      "items": [
        {
          "sku": "1032-1190678776101_ad446d9bcef83c4d9edacd7753580789",
          "part_number": "1032-1190678776101",
          "name": "LEGO Star Wars: The Complete Saga - Xbox 360",
          "brand": "LucasArts",
          "qty": 1,
          "frame_id": 1,
          "retail_price": 19.99,
          "discount_price": 19.99,
          "price": 19.99,
          "subtotal": 19.99,
          "currency": "USD",
          "merchant_item_id": "1190678776101",
          "merchant_sku": "8595763",
          "images": [
            "http://images.bestbuy.com/BestBuy_US/img/products/8595/8595763.jpg"
          ],
          "category": "Electronics > Video Games > Xbox 360"
        }
      ]
    },
    {
      "id": 1069,
      "name": "DTLR",
      "customer_service_url": "http://www.dtlr.com/document/customer-service.html",
      "return_policy_url": "http://www.dtlr.com/document/return-policy.html",
      "ship_flat_rate": 10,
      "ship_free_min": 100,
      "subtotal": 101.5,
      "shipping_fee": 0,
      "items": [
        {
          "sku": "1069-e2aa20de-e3f1-43e2-a9d0-6ebac7f66911_756dbdb272413d3f4963be7f59e3d665",
          "part_number": "1069-e2aa20de-e3f1-43e2-a9d0-6ebac7f66911",
          "name": "Oaxaca Jean Dark Jeans Size - 40",
          "brand": "MEK Denim",
          "qty": 1,
          "frame_id": 1,
          "color": "Medium",
          "size": "36",
          "retail_price": 101.5,
          "sale_price": 89.5,
          "discount_price": 101.5,
          "price": 89.5,
          "subtotal": 89.5,
          "currency": "USD",
          "merchant_item_id": "e2aa20de-e3f1-43e2-a9d0-6ebac7f66911",
          "merchant_sku": "400000333212",
          "images": [
            "http://www.dtlr.com/upload/img/MEK-Denim-Oaxaca-Jean-Dark/Medium/MEK-Denim-Oaxaca-Jean-Dark-Medium_M5C2n_600__scale_width.jpg"
          ],
          "category": "Men's > Denim"
        }
      ]
    }
  ]
}

Delete item

Removes an item (by SKU) from an existing shopping cart.

Request format

http://api.shoppable.com/v3/cart/:Id/delete/:sku

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart/04ac3fc0-bca4-435b-94cf-4646889ed8e/delete/1069-5d27a56d-165f-44ee-a6e3-9e666799666a_9dec3c470169aa430c98fd3f7806c9a8

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Request parameters

Parameter Type Description
id

REQUIRED

URL Param The Id of the requested shopping cart.
sku

REQUIRED

URL Param The SKU of the item you'd like to delete from the shopping cart.

Response object

Same as Get cart, refer to that response object.

Example response

Same as Get cart, refer to that example.

Clear cart

Clears all items from an existing shopping cart.

Request format

http://api.shoppable.com/v3/cart/:Id/clear

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart/04ac3fc0-bca4-435b-94cf-4646889ed8e/clear

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Request parameters

Parameter Type Description
id

REQUIRED

URL Param The Id of the requested shopping cart.

Response object

Same as Get cart, refer to that response object.

Example response

Same as New cart, refer to that example.

Cart Validate

Validate cart’s items price and stock status from an existing shopping cart.

Request format

http://api.shoppable.com/v3/cart/:Id/validate

cURL Example

curl -H "Bearer TokenExample1234567890" http://api.shoppable.com/v3/cart/04ac3fc0-bca4-435b-94cf-4646889ed8e/validate

Request Header

Parameter Description
Authorization The API token for your domain. The API token must match the domain in the Bearer header.
Content-Type Content Type. Ex. application/json

Request parameters

Parameter Type Description
id

REQUIRED

URL Param The Id of the requested shopping cart.

Response object

Attribute Description
before Product status before the spot check.
after Product status after the spot check.
sku Sku for this product variation.
retail_price Current retail price.
sale_price Current sale price.
discount_price Current discount price after applied existing coupon.
price Current lowest price. Comparing retail_price, sale_price and discount price for this product variatio.
active Current stock status for this product varitaion. 1 = instock, 0 = out of stock, -1 = Stock status cannot be verified.
msg Response message.
See Get cart for cart item object attribute details.

Example response

{
  "cart": {
    "id": "22d71c39-28e3-4d2e-a4e8-dcbc2e3b5bfd",
    "qty": 2,
    "subtotal": 121.49
  },
  "merchants": [
    {
      "id": 1032,
      "name": "Best Buy",
      "customer_service_url": "http://www.bestbuy.com/site/Global/Customer-Service/pcmcat87800050001.c?id=pcmcat87800050001",
      "return_policy_url": "http://www.bestbuy.com/site/Help-Topics/Returning-Online-Purchases/pcmcat260800050014.c?id=pcmcat260800050014",
      "ship_flat_rate": 0,
      "ship_free_min": 0,
      "subtotal": 19.99,
      "shipping_fee": 0,
      "items": [
        {
          "sku": "1032-1190678776101_ad446d9bcef83c4d9edacd7753580789",
          "part_number": "1032-1190678776101",
          "name": "LEGO Star Wars: The Complete Saga - Xbox 360",
          "brand": "LucasArts",
          "qty": 1,
          "frame_id": 1,
          "retail_price": 19.99,
          "discount_price": 19.99,
          "price": 19.99,
          "subtotal": 19.99,
          "currency": "USD",
          "merchant_item_id": "1190678776101",
          "merchant_sku": "8595763",
          "images": [
            "http://images.bestbuy.com/BestBuy_US/img/products/8595/8595763.jpg"
          ],
          "category": "Electronics > Video Games > Xbox 360"
        }
      ]
    }
  ],
  {
    "spot_check":{
      "before": [
        {
          "sku": "16939-2736418729_c0d97d381c26e7c82fd90a57ade72f13",
          "status":1,
          "retail_price":41,
          "price":41
        }
      ],
      "after": [
        {
          {
            "sku": "16939-2736418729_c0d97d381c26e7c82fd90a57ade72f13",
            "status":1,
            "retail_price":41,
            "price":41,
            "msg":"Success"
          }
        }
      ]
    }
  }
}