Basket

The Basket API allows users to create and manage their shopping baskets within the Let’sTrade system. Users can add products, view basket details, and perform other actions related to their shopping experience.

API Base URL

The base URL for all API endpoints is:

https://lets-trade-basket-prod.letstrade.global

Attributes of a Basket

  1. User ID (user_id): The ID of the user who owns the basket.

  2. User (user): Detailed information about the user.

    1. User ID (_id): User’s unique identifier.

    2. User Name (name): User’s first name.

    3. User Surname (surname): User’s last name.

    4. User Email (email): User’s email address.

    5. User Country Code (cell_country_code): Country code for the user’s cell number.

    6. User Cell Number (cell_number): User’s cell number.

    7. User Birthday (birthday): User’s date of birth.

  3. Client ID (client_id): The client’s unique identifier.

  4. Delivery Fees (delivery_fee): Fee for delivery.

  5. Total (total): Total amount for the basket.

  6. Product Handling Fees (product_handling_fees): Fees for handling the products.

  7. V AT (vat): Value-added tax for the basket.

  8. Sub Total (sub_total): Subtotal amount for the basket.

  9. Branch Information (branch): Information about the branch where the basket is created.

    1. Branch ID (_id): Branch’s unique identifier.

    2. Branch Extra Data (extra_data): Additional data related to the branch.

    3. Branch Display Name (display_name): Display name of the branch.

    4. Branch Email (email): Email address of the branch.

    5. Branch Number (branch_number): Branch’s number.

    6. Branch Address (address): Address information of the branch.

      1. Full Address (full_address): Full address.

      2. Longitude (longitude): Longitude coordinate.

      3. Latitude (latitude): Latitude coordinate.

      4. Line One (line_one): Address line one.

      5. Line Two (line_two): Address line two.

      6. Town (town): Town name.

      7. City (city): City name.

      8. Province (province): Province name.

      9. Country (country): Country name.

      10. Postal Code (postal_code): Postal code.

    7. Franchise (franchise): Indicates if the branch is a franchise.

    8. Registered Name (registered_name): Registered name of the branch.

    9. VAT Registered (vat_registered): Indicates if the branch is VAT registered.

    10. VAT Number (vat_number): VAT number of the branch.

    11. Contact Number (contact_number): Contact number of the branch.

    12. Registration Number (registration_number): Registration number of the branch.

    13. Delivery Information (delivery): Delivery information.

      1. Delivery (delivery): Indicates if delivery is available.

      2. Delivery Fee (delivery_fee): Fee for delivery.

      3. Max Delivery Radius (max_delivery_radius): Maximum delivery radius.

      4. Delivery Fee per KM (delivery_fee_per_km): Delivery fee per kilometer.

      5. Base Delivery Radius (base_delivery_radius): Base delivery radius.

      6. Last Collection Time (last_collection_time): Last collection time.

      7. Last Delivery Time (last_delivery_time): Last delivery time.

      8. Delivery Radii (delivery_radii): Delivery radii information.

      9. Delivery Hours (delivery_hours): Delivery hours.

      10. Delivery Fee type (delivery_fee_type): Type of delivery fee.

    14. Offline (offline): Indicates if the branch is offline.

    15. Working Hours (working_hours): Working hours of the branch.

    16. Exclusion Areas (exclusion_areas): Exclusion areas for delivery.

    17. Coordinates (coordinates): Coordinates of the branch.

    18. Country Code (country_code): Country code.

    19. Country Code Extension (country_code_extension): Country code extension

  10. Status (status): Status of the basket.

  11. Channel (channel): Channel through which the basket was created.

  12. Provider (provider): Provider of the basket.

  13. Straw (straw): Indicates if straw is required.

  14. Cutlery (cutlery): Indicates if cutlery is required.

  15. Serviettes (serviettes): Indicates if serviettes are required.

  16. Type (type): Type of the basket (e.g., collection, delivery).

  17. Address (address): Address information for delivery.

  18. Outstanding Amount (outstanding_amount): Outstanding amount for the basket.

  19. Paid Amount (paid_amount): Paid amount for the basket.

  20. Deal (deals): List of deals applied to the basket.

  21. Vouchers (vouchers): List of vouchers applied to the basket.

Create Basket

POST /v2/create

This endpoint allows the creation of a new basket for a user, specifying whether it’s for collection or delivery and which branch it belongs to.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

user_id*

string

The ID of the user who owns the basket.

branch_id*

string

The ID of the branch where the basket is created.

type*

string

The type of the basket, either collection or delivery.

Sample Request

{
    "user_id": "1234567890abcdef12345678",
    "branch_id": "1234567890abcdef12345678",
    "type": "collection"
}

Response

{
    "success": true,
    "message": "Basket successfully created!",
    "content": {
        "user_id": "1234567890abcdef12345678",
        "user": {
            "_id": "1234567890abcdef12345678",
            "name": "John",
            "surname": "Doe",
            "email": "[email protected]",
            "cell_country_code": "+1",
            "cell_number": "1234567890",
            "birthday": "1990-01-01T00:00:00.000Z",
            "client_id": "abcdef1234567890abcdef12"
        },
        "client_id": "abcdef1234567890abcdef12",
        "delivery_fee": "5.00",
        "total": "50.00",
        "product_handling_fees": "2.00",
        "vat": "3.00",
        "sub_total": "45.00",
        "products": [
            {
                "_id": "668cec84b9f8a87a0a490d3e",
                "quantity": 1,
                "price": "25.00",
                "total_price": "25.00",
                "name": "Sample Product",
                "description": "This is a sample product.",
                "image_url": "https://example.com/product.jpg",
                "variations": [
                    {
                        "_id": "668cecb5b9f8a87a0a490d68",
                        "ref": "FE0NVVzs0m"
                    }
                ],
                "condiments": [
                    {
                        "_id": "668edb57a21298abfb4ff32c",
                        "product_list": [
                            {
                                "_id": "666d53f54f228d1eeb14582a",
                                "name": "Condiment 1"
                            },
                            {
                                "_id": "666d53f54f228d1eeb14582e",
                                "name": "Condiment 2"
                            }
                        ]
                    },
                    {
                        "_id": "668edde61eb3ab17469bf065",
                        "product_list": [
                            {
                                "_id": "666d53f44f228d1eeb14563e",
                                "name": "Condiment 3"
                            },
                            {
                                "_id": "666d53f54f228d1eeb145892",
                                "name": "Condiment 4"
                            },
                            {
                                "_id": "666d53f44f228d1eeb145641",
                                "name": "Condiment 5"
                            }
                        ]
                    }
                ]
            }
        ],
        "branch": {
            "_id": "abcdef1234567890abcdef34",
            "extra_data": [
                {
                    "name": "property_id",
                    "value": "1001"
                },
                {
                    "name": "store_id",
                    "value": "101"
                }
            ],
            "display_name": "Main Street Branch",
            "email": "[email protected]",
            "branch_number": "BR001",
            "address": {
                "full_address": "123 Main Street, Springfield, USA",
                "longitude": "-93.0000",
                "latitude": "37.0000",
                "line_one": "123 Main Street",
                "line_two": "",
                "town": "Springfield",
                "city": "Springfield",
                "province": "Illinois",
                "country": "USA",
                "postal_code": "62701"
            },
            "franchise": false,
            "registered_name": "Main Street Branch LLC",
            "vat_registered": true,
            "vat_number": "123456789",
            "contact_number": "555-1234",
            "registration_number": "987654321",
            "delivery": {
                "delivery": true,
                "delivery_fee": "5.00",
                "max_delivery_radius": "10",
                "delivery_fee_per_km": "0.50",
                "base_delivery_radius": "5",
                "last_collection_time": "20:00",
                "last_delivery_time": "22:00",
                "delivery_radii": null,
                "delivery_hours": [
                    {
                        "day": "Monday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Tuesday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Wednesday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Thursday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Friday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Saturday",
                        "from": "08:00",
                        "to": "22:00"
                    },
                    {
                        "day": "Sunday",
                        "from": "08:00",
                        "to": "22:00"
                    }
                ],
                "delivery_fee_type": "FLAT-FEE"
            },
            "offline": false,
            "working_hours": [
                {
                    "day": "Monday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Tuesday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Wednesday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Thursday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Friday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Saturday",
                    "from": "08:00",
                    "to": "22:00"
                },
                {
                    "day": "Sunday",
                    "from": "08:00",
                    "to": "22:00"
                }
            ],
            "exclusion_areas": [
                {
                    "name": "Restricted Area",
                    "coordinates": [
                        {
                            "lat": "37.0001",
                            "lng": "-93.0001"
                        },
                        {
                            "lat": "37.0002",
                            "lng": "-93.0002"
                        },
                        {
                            "lat": "37.0003",
                            "lng": "-93.0003"
                        },
                        {
                            "lat": "37.0004",
                            "lng": "-93.0004"
                        },
                        {
                            "lat": "37.0005",
                            "lng": "-93.0005"
                        }
                    ]
                }
            ],
            "coordinates": [
                -93.0000,
                37.0000
            ],
            "country_code": "+1",
            "country_code_extension": "US"
        },
        "status": "ACTIVE",
        "channel": "LETS-TRADE",
        "provider": "BRANCH",
        "straw": false,
        "cutlery": false,
        "serviettes": false,
        "type": "collection",
        "address": null,
        "outstanding_amount": "0.00",
        "paid_amount": "0.00",
        "deals": [],
        "vouchers": []
    }
}

Get Basket

GET /v2/basket

This endpoint retrieves the current basket for a specified user.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Query Parameters

Name
Description

user_id

The ID of the user whose basket is to be retrieved.

Sample Request

curl --location '{base_ur}/v2/basket?user_id=622228a98268abc18c9e87eee' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN'

Response: Full basket is always returned. See response here.

Add Product to Basket

POST /v2/add/product

This endpoint allows adding a product to an existing basket by specifying the basket ID and product details.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

_id*

string

The ID of the basket

product*

object

Details of the product to add to the basket.

Product

Name
Type
Description

_id*

string

The ID of the product

quantity*

string

The quantity of the product.

variations

array

List of variations for the product

{
  "_id": "12345",
  "ref": "FE0NVVzs0m"
}

condiments

array

List of condiments for the product.

Sample Request

{
    "_id": "66978b2b6ff5ed54ea5bed07",
    "product": {
        "_id": "668cec84b9f8a87a0a490d3e",
        "quantity": "1",
        "variations": [
            {
                "_id": "668cecb5b9f8a87a0a490d68",
                "ref": "FE0NVVzs0m"
            }
        ],
        "condiments": [
            {
                "_id": "668edb57a21298abfb4ff32c",
                "product_list": [
                    {
                        "_id": "666d53f54f228d1eeb14582a"
                    },
                    {
                        "_id": "666d53f54f228d1eeb14582e"
                    }
                ]
            },
            {
                "_id": "668edde61eb3ab17469bf065",
                "product_list": [
                    {
                        "_id": "666d53f44f228d1eeb14563e"
                    },
                    {
                        "_id": "666d53f54f228d1eeb145892"
                    },
                    {
                        "_id": "666d53f44f228d1eeb145641"
                    }
                ]
            }
        ]
    }
}

or

{
    "_id": "66978b2b6ff5ed54ea5bed07",
    "product": {
        "_id": "668cec84b9f8a87a0a490d3e",
        "quantity": "1",
    }
}

Response: Full basket is always returned. See response here.

Remove Products from Basket

PUT /v2/remove/products

This endpoint allows removing specified products from an existing basket.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

_id*

string

The ID of the basket.

product_id_list*

array

List of product IDs to be removed from the basket.

Sample Request

{
    "_id": "64cba5316c6fc2d61cd66e33",
    "product_id_list": [
        "64cbb3ade5d471c79f1af3dd"
    ]
}

Response: Full basket is always returned. See response here.

Cancel Basket

PUT /v2/cancel

This endpoint allows canceling an existing basket.

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body

Name
Type
Description

_id*

string

The ID of the basket.

Sample Request

{
  "_id": "64cba5316c6fc2d61cd66e33"
}

Response: Full basket is always returned. See response here.

Last updated