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>"
      }
    ],
    "status": "pending",
    "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.

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": 201,
  "success": true,
  "message": "Order created successfully",
  "data": {
    "_id": "690ff00acf4de460fd1f6114",
    "orderId": 1001,
    "user": "68f976e92bb0b821425fdda6",
    "shop": "68b8f52575da81b332af29f1",
    "items": [
      {
        "product": "68e5bb463a1fc56a8ac150bf",
        "name": "Head phone",
        "price": 10000,
        "quantity": 2,
        "_id": "690ff00acf4de460fd1f6115"
      }
    ],
    "status": "pending",
    "subtotal": 20000,
    "shippingCost": 0,
    "total": 20000,
    "createdAt": "2025-11-14T15:30:00.000Z",
    "updatedAt": "2025-11-14T15:30:00.000Z"
  }
}

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