Cart

Operation related to customer's cart in Deeple system

Structure

Cart structure

Field nameTypesRequired/OptionalDescription
productCodestring(30)RUser’s selected product code
pricenumber(10)RSelected product’s price
amountnumber(10)RUser’s selected amount
stocknumber(10)RThe current stock of selected product from previous called of 3rd part API
isFreebooleanOIndicator whether this product is free or not

Example of cart structure

{
"productCode": "VA-4017",
"price": 250,
"amount": 4,
"stock": 50,
"isFree": false
}

Get cart summary

Get cart summary of customer’s selected products from VILLA API, this will take into account promotion associated with selected products from the user’s shopping cart.

Resource method

POST

Parameters

Request parameters from Deeple system to 3rd party API

Field nameTypesRequired/OptionalDescription
userIdstring(36)RUser’s id from either LINE or Facebook
postalCodestring(10)OUser’s postal code
cartarray of cart objectRUser’s shopping cart

Example request parameter

{
"userId": "U1325a29a021d91231239123",
"postalCode": "12345",
"cart": [
{
"productCode": "VA-4017",
"price": 250,
"amount": 4,
"stock": 50,
"isFree": false
},
{
"productCode": "VA-4015",
"price": 250,
"amount": 1,
"stock": 50,
"isFree": true
}
]
}

Example expected response object

{
"grandTotal": 1000,
"totalProductDiscount": 0,
"totalPrice": 934.58,
"vatPrice": 65.42,
"vatValue": 7,
"vatOption": "INCLUDED",
"cart": [
{
"productCode": "VA-4017",
"name": "TGM ไทยซอสเซส 200 กรัม",
"description": "",
"images": [{ src: "https://google.com/image.png" }] // Always expected https image url
"price": 250,
"amount": 4,
"stock": 50,
"isFree": false
},
{
"productCode": "VA-4015",
"name": "TGM ตับบด 200 กรัม",
"description": "",
"images": [{ src: "https://google.com/image.png" }] // Always expected https image url
"price": 250,
"amount": 1,
"stock": 50,
"isFree": true
}
]
}