Skip to main content
POST
/
orders
/
from-cart
Create order from cart
curl --request POST \
  --url https://store.salesive.com/api/v1/orders/from-cart \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-shop-id: <api-key>' \
  --data '
{
  "productIds": [
    "<string>"
  ],
  "items": [
    {
      "productId": "<string>",
      "variantId": "<string>"
    }
  ],
  "indices": [
    1
  ]
}
'
{
  "status": 123,
  "success": true,
  "message": "<string>",
  "data": {
    "_id": "<string>",
    "orderId": 123,
    "user": "<string>",
    "shop": "<string>",
    "items": [
      {
        "product": "<string>",
        "name": "<string>",
        "price": 123,
        "quantity": 2,
        "variant": "<string>",
        "sku": "<string>",
        "variantAttributes": {},
        "imageUrl": "<string>"
      }
    ],
    "subtotal": 123,
    "shippingCost": 123,
    "total": 123,
    "shippingAddress": {
      "fullName": "<string>",
      "addressLine1": "<string>",
      "city": "<string>",
      "state": "<string>",
      "zipCode": "<string>",
      "country": "<string>",
      "phoneNumber": "<string>",
      "addressLine2": "<string>"
    },
    "payment": "<string>",
    "shipment": "<string>",
    "notes": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  }
}

Request

POST /orders/from-cart
Authorization: Bearer {{token}}
x-shop-id: {{shopId}}
Content-Type: application/json

{}

Headers

HeaderTypeDescription
AuthorizationstringProvide the customer token as Bearer <jwt>.
x-shop-idstringIdentify the shop that owns the order.
Content-TypestringAlways set to application/json.

Body parameters

You can create an order using one of the following methods:
FieldTypeRequiredDescription
productIdsarrayNoArray of product IDs to include (any variants of these products).
itemsarrayNoArray of explicit items with productId and optional variantId.
indicesarrayNoArray of 0-based cart item positions to include.
If no body parameters are provided, the entire cart will be converted into an order.
Food and service cart items have no productId, so select them with indices (0-based cart positions) or send an empty body to include the whole cart. The resulting order items carry an itemType of product, food, or service; service items reference service and include any selectedAddons. Service (business) orders are non-shippable, so shippingCost is 0 and no shipment is created.

Request examples

Create order from entire cart

{}

Create order from selected products

{
  "productIds": [
    "68e5bb463a1fc56a8ac150bf",
    "68e5bb463a1fc56a8ac150c0"
  ]
}

Create order from explicit items

{
  "items": [
    { "productId": "68e5bb463a1fc56a8ac150bf" },
    { "productId": "68e5bb463a1fc56a8ac150bf", "variantId": "68e5c1303a1fc56a8ac151e2" }
  ]
}

Create order from cart indices

{
  "indices": [0, 2]
}

Successful response

{
    "status": 200,
    "success": true,
    "message": "Order created from cart",
    "data": {
        "_id": "6a27d632289b87893fcbde35",
        "user": "69360693a7a8f7dc8ae32d6d",
        "shop": "68b8f52575da81b332af29f1",
        "items": [
            {
                "product": "69fb494e51280f9f65d059ae",
                "variant": null,
                "name": "Wristwatch",
                "price": 45000,
                "quantity": 1,
                "imageUrl": "https://cdn.salesive.com/products/wristwatch.webp",
                "_id": "6a27d632289b87893fcbde36"
            }
        ],
        "status": "pending",
        "source": "online",
        "paymentMethod": "other",
        "payment": null,
        "discount": 0,
        "coupon": null,
        "subtotal": 45000,
        "shippingCost": 0,
        "tax": 0,
        "fee": 675,
        "posCustomerName": null,
        "posCustomerEmail": null,
        "posCustomerPhone": null,
        "shipment": null,
        "deleted": false,
        "deletedAt": null,
        "orderId": 17,
        "createdAt": "2026-06-09T09:00:34.748Z",
        "updatedAt": "2026-06-09T09:00:34.748Z",
        "__v": 0,
        "total": 45675,
        "amount": 45000,
        "id": "6a27d632289b87893fcbde35"
    }
}

Error response

{
    "status": 400,
    "success": false,
    "message": "Cart is empty",
    "data": {}
}

Authorizations

Authorization
string
header
required

JWT issued by the Salesive Store API for authenticated shoppers.

x-shop-id
string
header
required

Optional storefront identifier sent as a header to scope responses to a specific shop. Try It requests remember this value once provided.

Headers

x-shop-id
string

Optional identifier that scopes responses to a specific storefront when the referer cannot be inferred.

Body

application/json

If no parameters provided, entire cart will be converted to order.

productIds
string[]

Array of product IDs to include (any variants of these products).

items
object[]

Array of explicit items with productId and optional variantId.

indices
integer[]

Array of 0-based cart item positions to include.

Required range: x >= 0

Response

Order created successfully.

status
integer
required
success
boolean
required
message
string
required
data
object
required