Basket API
Visitors may add products to their baskets ("shopping carts") and then purchase ("lock") them.
Shopping carts¶
A shopping cart resource has the following attributes.
Attribute | Type | Description |
---|---|---|
id |
UUID | Unique identifier for the shopping cart |
visitor_id |
string | The identifier for the visitor to whom the shopping cart belongs |
session_id |
string | The ID of the session on which the visitor created this shopping cart. |
created_at |
datetime | When this shopping cart was created. In practice, this is just before the very first product is added to the shopping cart. |
updated_at |
datetime | When this shopping chart was last time altered. |
total_value |
string | Decimal string (e.g. "145.50" ) of the total value of the products in the shopping cart. This will contain any discounts and delivery costs, and may therefore differ from the sum value of the products in the cart. This does not contain any monthly subscriptions. This value is represented in the currency described by currency attribute. |
total_subscription_value |
string | Decimal string (e.g. "19.90" ) of the total monthly subscription value of any "subscription" products in the cart. For example, if the visitor is about to subscribe the product A with monthly fee 15.50 and the product B with monthly fee 3.00, then the total value would be 18.50. This value is represented in the currency described by currency attribute per month. |
currency |
string | The currency of the shopping cart, in which all the values (including values of the products) are represented. Currency is a upper-case ISO 4217 currency code, e.g. EUR . |
is_locked |
boolean | Whether or not the cart has been "locked", meaning that the visitor has actually purchased its contents. If true then the visitor has purchased the contents of the cart. If false , the visitor is still shopping or has abandonded the cart. |
locked_at |
datetime | When the cart was locked, or null if the cart is not yet locked. |
List shopping carts of a visitor¶
Example request:
1 |
|
Example response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
To list all the shopping carts of a visitor that is a member of a chat, use the following endpoint:
GET /api/v5/users/<user_id>/chats/<chat_id>/visitors/<visitor_id>/shopping_carts
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if the user is not a member of the chat
- 404 if the visitor is not a member of the chat
List shopping carts of a room visitor¶
To list all the shopping carts of a visitor in a room, use the following endpoint:
GET /api/v5/users/<user_id>/rooms/<room_id>/visitors/<visitor_id>/shopping_carts
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 403 if the user does not have access to the room
List shopping carts of organization's owned chats¶
To list all shopping carts of organization's owned chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/owned_chats/<chat_id>/shopping_carts
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if chat was not found
List shopping carts of organization's involved chats¶
To list all shopping carts of organization's involved chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/involved_chats/<chat_id>/shopping_carts
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if chat was not found
List shopping carts of organization's routed chats¶
To list all shopping carts of organization's routed chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/routed_chats/<chat_id>/shopping_carts
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if chat was not found
Shopping cart products¶
A shopping cart product resource describes one product that the visitor has added to the basket. A product may have a quantity, so it may represent more than one item. It has the following attributes:
Attribute | Type | Description |
---|---|---|
id |
UUID | Unique identifier for this product record within the shopping cart. Note that it does not identify the product in the shop. |
shopping_cart_id |
UUID | ID of the Shopping cart to which this product record belongs |
created_at |
datetime | When this product was added to the shopping cart |
updated_at |
datetime | When this product record was last time modified |
is_deleted |
boolean | Whether or not the product was in the cart at some point but was then removed from it. If this is true , you should ignore this record from the value of the cart. |
deleted_at |
datetime | When this product record deleted from the shopping cart, or null if it currently exists in the cart. |
name |
string | The name of the product |
description |
string | The description of the product |
category_name |
string | The name of the category to which the product belongs |
value |
string | The value of a single piece of this product, as decimal string (e.g. "199.90" ). This is represented in the currency of the shopping cart. |
subscription_value |
string | The value of a single subscription of this product per month, as a decimal string (e.g. "9.90" ). This is represented in the currency of the shopping cart. |
product_number |
string | The product number, code or other identifier for this product in the shop. |
quantity |
number | How many pieces of this product this record represents. The total value of this record is the value multiplied with the quantity . |
monthly_quantity |
number | How many subscriptions of this product this record represents. The total subscription value of this record is the subscription_value multiplied with monthly quantity . |
stock_balance |
number | How many items of this product there were in the stock at the time. |
List shopping cart products of a visitor¶
Example request:
1 |
|
Example response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
To list all the shopping cart products of a visitor that is a member of a chat, use the following endpoint:
GET /api/v5/users/<user_id>/chats/<chat_id>/visitors/<visitor_id>/shopping_carts/<cart_id>/products
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the user
- 404 if the user is not a member of the chat
- 404 if the visitor is not a member of the chat
- 404 if the shopping cart is not one of the shopping carts of the visitor
List shopping cart products of organization's owned chats¶
To list all shopping cart products of organization's owned chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/owned_chats/<chat_id>/shopping_carts/<cart_id>/products
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if cart was not found
- 404 if chat was not found
List shopping cart products of organization's involved chats¶
To list all shopping cart products of organization's involved chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/involved_chats/<chat_id>/shopping_carts/<cart_id>/products
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if cart was not found
- 404 if chat was not found
List shopping cart products of organization's routed chats¶
To list all shopping cart products of organization's routed chats, use the following endpoint:
GET /api/v5/orgs/<organization_id>/routed_chats/<chat_id>/shopping_carts/<cart_id>/products
This endpoint returns:
- 200 if the request was successful
- 401 if you are not authenticated
- 403 if you do not have active subscription
- 403 if you do not have access to the organization
- 403 if you do not have
reports
permission and the organization has private history enabled - 404 if cart was not found
- 404 if chat was not found