Fetch cart list for a customer

GET /cart

Utilize this endpoint to access a detailed list of cart items linked to a specific customer within your organization. This version is more concise and maintains clarity while enhancing the overall flow

Header

                    
                        Authorization
                        Example: Bearer {YOUR_AUTH_KEY}
                        Content-Type
                        Example: application/json
                        Accept
                        Example: application/json
                    
                

Query Parameters

Parameter Datatype Description
customer_id Integer(required) The customer's unique identifier.

Response Parameters

Parameter Datatype Description
data object This object contains the entire resource.
cart_item_count Integer The number of items in cart.
total_cart_quantity Integer Sum of cart items quantity.
cart_total Double Total cart amount.
discount Double Total discount availed by the customer.
billable_amount Double Total amount payable by the customer.
items Collection The list of items associated with the cart.
items.id Integer The unique cart item identifier.
items.quantity Integer Item Count in Shopping Cart
items.product Collection The list of product associated with the cart item.
items.product.id Integer The unique identifier of the product.
items.product.name String The name of the product.
items.product.image String (URL) The URL of the product image.
items.product.sku String The SKU of the product and this also a unique identifier of the product.
items.product.hsn_code String The HSN code of the product.
items.product.description String The description of the product.
items.product.price_per_unit Double Price of the per unit product.
items.product.maximum_retail_price Double MRP of the product.
items.product.weight Double Per unit weight of the product.
items.product.vol Double Per unit volume of the product.
items.product.gst_percent Double GST percentage of the product.
items.product.measurementtype Collection Collection of product measurement type.
items.product.measurementtype.id Integer The unique identifier of the product measurement type.
items.product.measurementtype.name String The name of the product measurement type.
items.product.productcategory Collection Collection of product categories.
items.product.productcategory.id Integer The unique identifier of the product category.
items.product.productcategory.name String The name of the product category.
items.product.productcategory.image String (URL) The URL of the product category image.
items.product.productpricing Collection Collection of product pricing.
items.product.productpricing.id Integer Unique identifier or id of the product pricing or pricing set. Product pricings are pricing sets setup for specific buying quantities of the same product. Example - Tata Tea Gold is the product and Pack of 12, Pack of 18 or Pack of 24 are 3 product pricing sets of the product.
items.product.productpricing.product_id Integer ID of the product.
items.product.productpricing.buying_qty Integer Product Pricings are basically selling prices for a specific set of quantity or pricing set. Here buying_qty refers to the qty against the pricing set .
items.product.productpricing.price Double Selling price of the specific product pricing or pricing set against the specific buying quantity .

Sample Request

                    
                        curl --location 'https://testwebservices.sourcehub.in/api/carts?customer_id=9' \
--header 'Authorization: Bearer **********'
                    
                

Sample Success Response

                    
                        {
                            "data": {
                                "cart_item_count": 1,
                                "total_cart_quantity": 3,
                                "cart_total": 600,
                                "discount": 0,
                                "billable_amount": 600,
                                "items": [
                                    {
                                        "id": 79532,
                                        "quantity": 3,
                                        "product": {
                                            "id": 4,
                                            "name": "3 Roses Mrp 10 (408pc)",
                                            "image": "https://sourcehub.in/public/images/product/1605342130.jpg",
                                            "sku": "CP 2425 0046",
                                            "hsn_code": "0902",
                                            "description": "",
                                            "price_per_unit": 10,
                                            "maximum_retail_price": 4080,
                                            "weight": 3000,
                                            "vol": 0,
                                            "gst_percent": 5,
                                            "measurementtype": {
                                                "id": 5,
                                                "name": "bags"
                                            },
                                            "productcategory": {
                                                "id": 3,
                                                "name": "Tea ,Coffee and Beverages",
                                                "image": "https://sourcehub.in/public/images/productcategory/1617180572.jpg"
                                            },
                                            "productpricing": {
                                                "id": 1058,
                                                "product_id": 4,
                                                "buying_qty": 1,
                                                "price": 200
                                            }
                                        }
                                    }
                                ]
                            },
                            "message": "Cart items fetch successfully"
                        }
                    
                

Sample 401 Faliure Response

                    
                        {
                            "error": {
                                "code": "AUTHENTICATION_ERROR",
                                "description": "Invalid credential or token.",
                                "source": "https://webservices.sourcehub.in/api/items.product",
                                "status_code": 401
                            }
                        }
                    
                

Errors

The API key/secret provided is invalid. Error Status: 401

The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons are:

  • Different keys for test mode and live modes.
  • Expired API key.

Solution :
The API keys must be active and entered correctly with no whitespace before or after the keys.

CONTENTS