curl --request POST \
--url https://store.salesive.com/api/v1/cart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop-id: <api-key>' \
--data '
{
"productId": "<string>",
"foodId": "<string>",
"serviceId": "<string>",
"variantId": "<string>",
"quantity": 1,
"selectedAddons": [
{
"addonId": "<string>",
"quantity": 1
}
]
}
'import requests
url = "https://store.salesive.com/api/v1/cart"
payload = {
"productId": "<string>",
"foodId": "<string>",
"serviceId": "<string>",
"variantId": "<string>",
"quantity": 1,
"selectedAddons": [
{
"addonId": "<string>",
"quantity": 1
}
]
}
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
productId: '<string>',
foodId: '<string>',
serviceId: '<string>',
variantId: '<string>',
quantity: 1,
selectedAddons: [{addonId: '<string>', quantity: 1}]
})
};
fetch('https://store.salesive.com/api/v1/cart', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/cart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'productId' => '<string>',
'foodId' => '<string>',
'serviceId' => '<string>',
'variantId' => '<string>',
'quantity' => 1,
'selectedAddons' => [
[
'addonId' => '<string>',
'quantity' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/cart"
payload := strings.NewReader("{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/cart")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/cart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {
"_id": "<string>",
"items": [
{
"name": "<string>",
"image": "<string>",
"price": 123,
"quantity": 2,
"_id": "<string>",
"product": {
"_id": "<string>",
"id": "<string>",
"name": "<string>",
"images": [
"<string>"
],
"price": 123,
"promoPrice": 123,
"sku": "<string>",
"parentProductId": "<string>",
"variantAttributes": {}
},
"food": {
"_id": "<string>",
"id": "<string>",
"name": "<string>",
"images": [
"<string>"
],
"price": 123,
"promoPrice": 123
},
"foodId": "<string>",
"variant": "<string>",
"sku": "<string>",
"variantAttributes": {},
"selectedAddons": [
{
"addonId": "<string>",
"name": "<string>",
"price": 123,
"quantity": 2,
"description": "<string>"
}
]
}
],
"totalPrice": 123,
"user": "<string>",
"shop": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Add item to cart
Add a product, variant, food, or service item with optional add-ons to the authenticated shopper’s cart.
curl --request POST \
--url https://store.salesive.com/api/v1/cart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-shop-id: <api-key>' \
--data '
{
"productId": "<string>",
"foodId": "<string>",
"serviceId": "<string>",
"variantId": "<string>",
"quantity": 1,
"selectedAddons": [
{
"addonId": "<string>",
"quantity": 1
}
]
}
'import requests
url = "https://store.salesive.com/api/v1/cart"
payload = {
"productId": "<string>",
"foodId": "<string>",
"serviceId": "<string>",
"variantId": "<string>",
"quantity": 1,
"selectedAddons": [
{
"addonId": "<string>",
"quantity": 1
}
]
}
headers = {
"Authorization": "Bearer <token>",
"x-shop-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Bearer <token>',
'x-shop-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
productId: '<string>',
foodId: '<string>',
serviceId: '<string>',
variantId: '<string>',
quantity: 1,
selectedAddons: [{addonId: '<string>', quantity: 1}]
})
};
fetch('https://store.salesive.com/api/v1/cart', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://store.salesive.com/api/v1/cart",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'productId' => '<string>',
'foodId' => '<string>',
'serviceId' => '<string>',
'variantId' => '<string>',
'quantity' => 1,
'selectedAddons' => [
[
'addonId' => '<string>',
'quantity' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-shop-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://store.salesive.com/api/v1/cart"
payload := strings.NewReader("{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("x-shop-id", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://store.salesive.com/api/v1/cart")
.header("Authorization", "Bearer <token>")
.header("x-shop-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://store.salesive.com/api/v1/cart")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["x-shop-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"<string>\",\n \"foodId\": \"<string>\",\n \"serviceId\": \"<string>\",\n \"variantId\": \"<string>\",\n \"quantity\": 1,\n \"selectedAddons\": [\n {\n \"addonId\": \"<string>\",\n \"quantity\": 1\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": 123,
"success": true,
"message": "<string>",
"data": {
"_id": "<string>",
"items": [
{
"name": "<string>",
"image": "<string>",
"price": 123,
"quantity": 2,
"_id": "<string>",
"product": {
"_id": "<string>",
"id": "<string>",
"name": "<string>",
"images": [
"<string>"
],
"price": 123,
"promoPrice": 123,
"sku": "<string>",
"parentProductId": "<string>",
"variantAttributes": {}
},
"food": {
"_id": "<string>",
"id": "<string>",
"name": "<string>",
"images": [
"<string>"
],
"price": 123,
"promoPrice": 123
},
"foodId": "<string>",
"variant": "<string>",
"sku": "<string>",
"variantAttributes": {},
"selectedAddons": [
{
"addonId": "<string>",
"name": "<string>",
"price": 123,
"quantity": 2,
"description": "<string>"
}
]
}
],
"totalPrice": 123,
"user": "<string>",
"shop": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}Request
POST /cart
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json
{
"productId": "692cd420b07303c9be5eafd7",
"quantity": 2
}
Headers
| Header | Type | Description |
|---|---|---|
Authorization | string | Provide the customer token as Bearer <jwt>. |
x-shop-id | string | Identify the shop that owns the cart. |
Content-Type | string | Always set to application/json. |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
productId | string | No | Product identifier to add. Provide one of productId, foodId, or serviceId. |
foodId | string | No | Food item identifier (restaurant stores). |
serviceId | string | No | Service identifier (business stores). |
variantId | string | No | Variant identifier. Include it to add a specific product variant. |
quantity | integer | No | Quantity to add. Defaults to 1. |
selectedAddons | array | No | Array of add-on objects {addonId, quantity} for food or service items. |
product for ecommerce, food for restaurant, and service for business stores. Add the matching identifier (productId, foodId, or serviceId). Services behave like foods — they have no variants but can carry add-ons.Food request example
POST /cart
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json
{
"foodId": "68e5bb463a1fc56a8ac150c0",
"quantity": 1,
"selectedAddons": [
{
"addonId": "68e5bb463a1fc56a8ac150d1",
"quantity": 2
}
]
}
Service request example
POST /cart
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json
{
"serviceId": "6a2f8a7ba6656ba8cddfc1f5",
"quantity": 1,
"selectedAddons": [
{
"addonId": "6a2f8a7ba6656ba8cddfc201",
"quantity": 1
}
]
}
itemType: "service" and a populated service object (plus a serviceId convenience field), mirroring the food shape:
{
"itemType": "service",
"service": {
"_id": "6a2f8a7ba6656ba8cddfc1f5",
"name": "Home Cleaning"
},
"serviceId": "6a2f8a7ba6656ba8cddfc1f5",
"name": "Home Cleaning",
"image": "https://cdn.salesive.com/services/cleaning.webp",
"price": 20000,
"quantity": 1,
"selectedAddons": []
}
Successful response
{
"status": 200,
"success": true,
"message": "Item added to cart",
"data": {
"_id": "693606ada7a8f7dc8ae32d80",
"items": [
{
"itemType": "food",
"food": {
"_id": "68e5bb463a1fc56a8ac150c0",
"name": "Margherita Pizza"
},
"foodId": "68e5bb463a1fc56a8ac150c0",
"name": "Margherita Pizza",
"image": "https://cdn.salesive.com/foods/margherita.webp",
"price": 7500,
"quantity": 1,
"selectedAddons": [
{
"addonId": "68e5bb463a1fc56a8ac150d1",
"name": "Extra Cheese",
"description": "A richer mozzarella finish baked on top.",
"price": 1500,
"quantity": 2
}
],
"_id": "6937b6e9e455c711f1fc9064",
"id": "6937b6e9e455c711f1fc9064"
}
],
"totalPrice": 10500,
"id": "693606ada7a8f7dc8ae32d80"
}
}
Error response
{
"status": 404,
"success": false,
"message": "Product not found",
"data": null
}
Authorizations
JWT issued by the Salesive Store API for authenticated shoppers.
Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.
Headers
Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.
Body
- Option 1
- Option 2
- Option 3
Add a product/variant line item, a food line item, or a service line item, with optional add-ons. Use the identifier that matches the storefront catalog type: productId (ecommerce), foodId (restaurant), or serviceId (business).
Identifier of the product to add to the cart (ecommerce stores).
Identifier of the food item to add to the cart (restaurant stores).
Identifier of the service to add to the cart (business stores).
Optional identifier of the product variant to add.
Quantity of the product, food, or service to add. Defaults to 1.
x >= 1Optional add-on selections for food or service items.
Show child attributes
Show child attributes
Was this page helpful?

