Skip to content
On this page

Create Order ​

Create a new order in your store.

Endpoint ​

POST /api/orders/create

Request Body ​

FieldTypeRequiredDescription
customerobjectYesCustomer info
detailsarrayYesArray of order details
shippingobjectNoShipping info
discountobjectNoDiscount info
attachmentsarrayNoAttachments
bookingInfoobjectNoBooking info
statusstringNoOrder status
paymentobjectNoPayment info
methodobjectNoPayment method
customerNotestringNoCustomer note

Example ​

json
{
  "customer": {
    "_id": "customer_id",
    "firstname": "John",
    "lastname": "Doe",
    "email": "john@example.com"
  },
  "details": [
    {
      "product": {
        "_id": "product_id",
        "name": "T-shirt",
        "price": {
          "buyingPrice": 0,
          "salePrice": 2,
          "comparePrice": 0
        },
      },
      "variant":{
        "_id": "variant_id",
        "name": "Color : Red | Size : XS"
      }, //variant optional 
      "quantity": 2,
      "price": 40
    }
  ],
  "method":{
    "_id": "5feb408a2ef4130539efb9e0",
    "name": "CashOnDelivery"
  },
  "shipping": {
    "isFixed": false,
    "zone": { "_id": "zone_id", "name": "Zone 1" }, //optional
    "shipper": { "_id": "shipper_id", "name": "DHL" }, //optional
    "price": 10,
    "address": {
      "firstname": "John",
      "lastname": "Doe",
      "address1": "123 Main St",
      "city": { "_id": "city_id", "name": "City" }, //optional
      "country": { "_id": "country_id", "name": "Country" } //optional
    }
  },
  "discount": {
    "_id": "discount_id",
    "price": 5
  },
  "status": "PENDING",
  "customerNote": "Please deliver between 9am-5pm"
}

Response ​

json
{
  "status": "success",
  "data": {
    "_id": "string",
    "orderId": 1234,
    ...
  }
}

Released under the MIT License.