Create Order
Overview
The Store Order Endpoint allows users to create an order that will be validated and processed by Komerce. This endpoint integrates data obtained from previous steps:
- Search Destination Endpoint → Provides origin & destination IDs.
- Calculate Endpoint → Provides shipping cost details, including courier information.
Once an order is created, the system automatically deducts the shipping fee from the user’s dashboard balance (if using the Bank Transfer method). If the balance is insufficient, the order will not be processed, and an error response will be returned.
Key Features
✅ Seamless Order Creation – Integrates with previous endpoints to streamline the process.
✅ Automated Balance Deduction – Ensures smooth transactions for prepaid orders.
✅ Strict Data Validation – Ensures correct phone number format & other required fields.
✅ Supports Multiple Payment Methods – Including COD and Bank Transfer.
How it Works
Required Data for Order Creation
Users must provide the following details:
- Order Information → Order date, brand name, shipper & receiver details.
- Shipping Details → Courier name, service type, shipping cost.
- Payment Method → COD or Bank Transfer. Unfortunetly, we don't have invoicing method automaticly. But, you can use invoicing method if you contact our Business Development for request invoicing method.
- Product Details → Name, variant, weight, dimensions, quantity.
- Phone numbers must start with 62 or 8 (e.g., 6281234567890, 81234567890), not start with 0 or +62.
- An insufficient balance will prevent order processing if your balance is less than the value of the shipping charges to be made.
- Ensure all required fields are formatted correctly to avoid errors.
Order Processing and Validation
Once an order is submitted:
- The system validates the order details, including phone numbers, shipping cost, and payment method.
- If using Bank Transfer, the shipping cost is deducted from the user’s balance.
- If all data is valid, the order is sent to us for processing.
- The system returns a confirmation response, indicating the order has been successfully created.
Request Body
- cURL
- JavaScript
- PHP
- GoLang
- Node
curl --location 'https://api-sandbox.collaborator.komerce.id/order/api/v1/orders/store' \
--header 'x-api-key: inputapikey' \
--data-raw '{
"order_date": "2025-05-21",
"brand_name": "Xiaomi Official",
"shipper_name": "XIAOMI",
"shipper_phone": "82121669737",
"shipper_destination_id": 5969,
"shipper_address": "Alamat pengirim",
"shipper_email": "garut@gmail.com",
"origin_pin_point": "-7.274631, 109.207174"
"receiver_name": "Buyer Bandung",
"receiver_phone": "8123458282",
"receiver_destination_id": 4956,
"receiver_address": "Alamat penerima",
"shipper_email": "admin@admin.com",
"destination_pin_point": "-7.274631, 109.207174",
"shipping": "JNE",
"shipping_type": "REG23",
"payment_method": "BANK TRANSFER",
"shipping_cost": 16000,
"shipping_cashback": 4000,
"service_fee": 0,
"additional_cost": 0,
"grand_total": 516000,
"cod_value": 0,
"insurance_value": 5631.11,
"order_details": [
{
"product_name": "Xiaomi Redmi Note 99",
"product_variant_name": "Blue 8/256",
"product_price": 315555,
"product_weight": 1000,
"product_width": 10,
"product_height": 8,
"product_length": 50,
"qty": 1,
"subtotal": 315555
}
]
}'
const myHeaders = new Headers();
myHeaders.append("x-api-key", "inputapikey");
const raw = "{\n \"order_date\": \"2025-05-21\",\n \"brand_name\": \"Xiaomi Official\",\n \"shipper_name\": \"XIAOMI\",\n \"shipper_phone\": \"82121669737\",\n \"shipper_destination_id\": 5969,\n \"shipper_address\": \"Alamat pengirim\",\n \"shipper_email\": \"garut@gmail.com\",\n \"origin_pin_point\": \"-7.274631, 109.207174\",\n \"receiver_name\": \"Buyer Bandung\",\n \"receiver_phone\": \"8123458282\",\n \"receiver_destination_id\": 4956,\n \"receiver_address\": \"Alamat penerima\",\n \"receiver_email\": \"-7.274631, 109.207174\",\n \"shipping\": \"JNE\",\n \"shipping_type\": \"REG23\",\n \"payment_method\": \"BANK TRANSFER\",\n \"shipping_cost\": 16000,\n \"shipping_cashback\": 4000,\n \"service_fee\": 0,\n \"additional_cost\": 0,\n \"grand_total\": 516000,\n \"cod_value\": 0,\n \"insurance_value\": 5631.11,\n \"order_details\": [\n {\n \"product_name\": \"Xiaomi Redmi Note 99\",\n \"product_variant_name\": \"Blue 8/256\",\n \"product_price\": 315555,\n \"product_weight\": 1000,\n \"product_width\": 10,\n \"product_height\": 8,\n \"product_length\": 50,\n \"qty\": 1,\n \"subtotal\": 315555\n }\n ]\n}";
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://api-sandbox.collaborator.komerce.id/order/api/v1/orders/store", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-sandbox.collaborator.komerce.id/order/api/v1/orders/store',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"order_date": "2025-05-21",
"brand_name": "Xiaomi Official",
"shipper_name": "XIAOMI",
"shipper_phone": "82121669737",
"shipper_destination_id": 5969,
"shipper_address": "Alamat pengirim",
"shipper_email": "garut@gmail.com",
"origin_pin_point": "-7.274631, 109.207174",
"receiver_name": "Buyer Bandung",
"receiver_phone": "8123458282",
"receiver_destination_id": 4956,
"receiver_address": "Alamat penerima",
"receiver_email": "-7.274631, 109.207174",
"shipping": "JNE",
"shipping_type": "REG23",
"payment_method": "BANK TRANSFER",
"shipping_cost": 16000,
"shipping_cashback": 4000,
"service_fee": 0,
"additional_cost": 0,
"grand_total": 516000,
"cod_value": 0,
"insurance_value": 5631.11,
"order_details": [
{
"product_name": "Xiaomi Redmi Note 99",
"product_variant_name": "Blue 8/256",
"product_price": 315555,
"product_weight": 1000,
"product_width": 10,
"product_height": 8,
"product_length": 50,
"qty": 1,
"subtotal": 315555
}
]
}',
CURLOPT_HTTPHEADER => array(
'x-api-key: inputapikey'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.collaborator.komerce.id/order/api/v1/orders/store"
method := "POST"
payload := strings.NewReader(`{
"order_date": "2025-05-21",
"brand_name": "Xiaomi Official",
"shipper_name": "XIAOMI",
"shipper_phone": "82121669737",
"shipper_destination_id": 5969,
"shipper_address": "Alamat pengirim",
"shipper_email": "garut@gmail.com",
"origin_pin_point": "-7.274631, 109.207174",
"receiver_name": "Buyer Bandung",
"receiver_phone": "8123458282",
"receiver_destination_id": 4956,
"receiver_address": "Alamat penerima",
"receiver_email": "-7.274631, 109.207174",
"shipping": "JNE",
"shipping_type": "REG23",
"payment_method": "BANK TRANSFER",
"shipping_cost": 16000,
"shipping_cashback": 4000,
"service_fee": 0,
"additional_cost": 0,
"grand_total": 516000,
"cod_value": 0,
"insurance_value": 5631.11,
"order_details": [
{
"product_name": "Xiaomi Redmi Note 99",
"product_variant_name": "Blue 8/256",
"product_price": 315555,
"product_weight": 1000,
"product_width": 10,
"product_height": 8,
"product_length": 50,
"qty": 1,
"subtotal": 315555
}
]
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-api-key", "inputapikey")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
const axios = require('axios');
let data = '{\n "order_date": "2025-05-21",\n "brand_name": "Xiaomi Official",\n "shipper_name": "XIAOMI",\n "shipper_phone": "82121669737",\n "shipper_destination_id": 5969,\n "shipper_address": "Alamat pengirim",\n "shipper_email": "garut@gmail.com",\n "origin_pin_point": "-7.274631, 109.207174",\n "receiver_name": "Buyer Bandung",\n "receiver_phone": "8123458282",\n "receiver_destination_id": 4956,\n "receiver_address": "Alamat penerima",\n "receiver_email": "-7.274631, 109.207174",\n "shipping": "JNE",\n "shipping_type": "REG23",\n "payment_method": "BANK TRANSFER",\n "shipping_cost": 16000,\n "shipping_cashback": 4000,\n "service_fee": 0,\n "additional_cost": 0,\n "grand_total": 516000,\n "cod_value": 0,\n "insurance_value": 5631.11,\n "order_details": [\n {\n "product_name": "Xiaomi Redmi Note 99",\n "product_variant_name": "Blue 8/256",\n "product_price": 315555,\n "product_weight": 1000,\n "product_width": 10,\n "product_height": 8,\n "product_length": 50,\n "qty": 1,\n "subtotal": 315555\n }\n ]\n}';
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api-sandbox.collaborator.komerce.id/order/api/v1/orders/store',
headers: {
'x-api-key': 'inputapikey'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Query Parameter
Headers
Key | Type | Description |
---|---|---|
x-api-key * | string | this Value contain an secret APIKEY identic for Shipping API |
Body RAW
Key | Type | Description |
---|---|---|
order_date * | date-time | The date and time when the order was created. |
brand_name * | string | The brand name displayed on the shipping label. |
shipper_name * | string | The name of the person sending the package. |
shipper_phone * | string | The phone number of the sender. |
shipper_destination_id * | int | The ID representing the pickup location for the shipment. |
origin_pin_point | string | Geolocation (latitude, longitude) of the pickup address. |
shipper_address * | string | Full address of the sender for pickup. |
shipper_email * | string | Email address of the sender. |
receiver_name * | string | The name of the recipient. |
receiver_phone * | string | The phone number of the recipient. |
receiver_destination_id * | int | The ID representing the delivery destination. |
destination_pin_point | string | Geolocation (latitude, longitude) of the delivery address. |
receiver_address * | string | Full delivery address of the recipient. |
receiver_email | string | Email address of the recipient. |
shipping * | string | Selected shipping courier, e.g., JNE, SICEPAT, SAP, IDEXPRESS, J&T, NINJA. |
shipping_type * | string | Shipping service type, such as REG19, GOKIL, REGULER, INSTANT, etc. |
shipping_cost * | int | The standard shipping cost charged to the user. |
shipping_cashback * | int | Discount or cashback applied to the shipping cost. |
payment_method * | string | The payment method used for the order (e.g., COD, bank transfer). |
service_fee * | int | Additional fee charged when using COD (typically 2.8% of the product price). |
additional_cost * | int | Any extra costs related to the order (e.g., packaging, handling). |
grand_total * | int | Total payment amount, calculated as: product total + shipping cost + additional cost - shipping cashback. |
cod_value * | int | COD payment amount. This value must match the grand_total . |
insurance_value * | float | Declared value for insurance, if insurance is used. |
product_name * | string | Name of the product being shipped. |
product_variant_name * | string | Variant or specific type of the product (if applicable). |
product_price * | int | Price per unit of the product. |
product_width * | int | Product width in centimeters. |
product_height * | int | Product height in centimeters. |
product_length * | int | Product length in centimeters. |
product_weight * | int | Product weight in grams. |
qty * | int | Quantity of the product ordered. |
subtotal * | int | Total product value, calculated as product_price * qty . |
Additional information for the using origin or destination,
pin_point
is used to calculate the estimated shipping cost by using Instant or LionParcel Courier. Make sure thepin_point
data sent is in accordance with the estimated delivery from the origin location to the destination so that the courier can pick up and deliver to the appropriate address.
For each header and parameter that has a *
sign, it is a parameter that must be Required when making a request, otherwise there will be a system error that will warn the user regarding the request made.
Response
Response structure
Key | Value |
---|---|
meta.message | Response for creating an order |
meta.code | Any respons have different status code |
meta.status | Bollean status for creating an order |
data.order_id | An unique id if successfully creating an order |
data.order_no | An unique number for order |
Success Respons for Creating an Order
{
"meta": {
"message": "Success Create New Order",
"code": 201,
"status": "success"
},
"data": {
"order_id": 9999,
"order_no": "KOMXXXXXXXXXXXXXXXXX"
}
}
Error Respons for Creating an Order
{
"meta": {
"message": "{{ error.message }}",
"code": 400,
"status": "failed"
},
"data": null
}
Error Code
Code | Status | Description | How to Fix |
---|---|---|---|
400 | Failed | There is a mismatch in one or more of the parameters used | Check all available parameters, make sure the values entered match the desired conditions. |
401 | Unauthorized | API key invalid or missing from parameter | Make sure your API key is valid using your Account. |
422 | Unprocessable Entity | Parameter is missing | Add an valid parameter in your requested query. Parameter Request can't be null or missing |
500 | - | - | - |
Tips to Avoid Errors
- Always include the Authorization header with a valid token.
- Do not leave the any parameter empty — it’s required.
- Makesure all parameters using correct value
- Use the correct endpoint and query structure.