Cart
Operation related to customer's cart in Deeple system
Structure
Cart structure
Field name | Types | Required/Optional | Description |
---|---|---|---|
productCode | string(30) | R | User’s selected product code |
price | number(10) | R | Selected product’s price |
amount | number(10) | R | User’s selected amount |
stock | number(10) | R | The current stock of selected product from previous called of 3rd part API |
isFree | boolean | O | Indicator 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 name | Types | Required/Optional | Description |
---|---|---|---|
userId | string(36) | R | User’s id from either LINE or Facebook |
postalCode | string(10) | O | User’s postal code |
cart | array of cart object | R | User’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
}
]
}