Skip to content
Michal Gallovič edited this page Feb 19, 2020 · 2 revisions

Get Cart

GET /api/carts/{cart_token}

// standard cart response
response: {
  "success": true,
  "data": {
      "cart_token": "5f607f7c-5a24-4e14-ba20-f8f0b12fdfa8",
      "items_subtotal": "10.00",
      "tax_rate": "0.00",
      "tax": "0.00",
      "total": "10.00",
      "discount": "0.00",
      "shipping": "0.00",
      "customer_email": null,
      "shipping_first_name": null,
      "shipping_last_name": null,
      "shipping_address_line1": null,
      "shipping_address_line2": null,
      "shipping_address_city": null,
      "shipping_address_region": null,
      "shipping_address_zipcode": null,
      "shipping_address_phone": null,
      "billing_same": true,
      "billing_first_name": null,
      "billing_last_name": null,
      "billing_address_line1": null,
      "billing_address_line2": null,
      "billing_address_city": null,
      "billing_address_region": null,
      "billing_address_zipcode": null,
      "billing_address_phone": null,
      "customer_notes": null,
      "cart_items": [{
          "cart_item_token": "c10a4e87-378a-49b5-8388-33b25376fe2c"
          "price": "10.00"
          "quantity": "1"
          "customer_note": null
          "product": {
            "name": "Name"
            "image": null
            "price": "10.00"
          }
      }]
  }
}

Create Cart

Creates an empty cart or a cart with a product of quantity

GET /api/carts

optional parameters: {
  product_id: integer,exists: products
  quantity: integer|gte:1
}

response: {...} // standard cart response

Add Product to Cart

POST /api/carts/{cart-token}/cart-items

required parameters: {
  product_id: integer|exists: products
}

optional parameters: {
  quantity: integer // by default 1,
  customer_note: string
}

response: {...} // standard cart response

Update Cart

Updates cart customer email, shipping and billing details. If applied coupon_code exists in the coupons table, discount will be added to the cart.

PUT /api/carts/{cart-token}

optional paramenters: {
  coupon_code: string|exists: coupons,
  customer_email: string|email,
  customer_notes: string,
  shipping_first_name: string,
  shipping_last_name: string,
  shipping_address_line1: string,
  shipping_address_line2: string,
  shipping_address_city: string,
  shipping_address_region: string,
  shipping_address_zipcode: string,
  shipping_address_phone: string,
  billing_same: boolean,
  billing_first_name: string,
  billing_last_name: string,
  billing_address_line1: string,
  billing_address_line2: string,
  billing_address_city: string,
  billing_address_region: string,
  billing_address_zipcode: string,
  billing_address_phone: string
}

response: {...} // standard cart response

Update Cart Item

PUT /api/car-items/{cart-item-token}

optional parameters: {
  quantity: integer // by default 1,
  customer_note: string
}

response: {...} // standard cart response

Delete Cart

DELETE /api/carts/{cart-token}

response: {
  "success": true
}

Delete Cart Item

DELETE /api/cart-items/{cart-item-token}

response: {
  "success": true
}

Shipping address autocomplete

Shipping city and state is automatically resolved from zip code using GeoNames service http://www.geonames.org/

PUT /api/carts/{cart-token}/zipcode

required parameters: {
  zipcode: string
}

response: {...} // standard cart response
Clone this wiki locally