Calculate

Overview

The Calculate Endpoint is designed to help users retrieve accurate shipping cost estimates based on various factors such as origin, destination, and package weight. This endpoint is a crucial part of the Komship Delivery API, which integrates six courier services to facilitate seamless shipping operations.

By leveraging this endpoint, users can efficiently determine shipping fees without needing manual calculations, ensuring a faster, error-free, and automated process.

Key Feature

✅ Multi-Courier Support – Access shipping costs from six courier services in one request.
✅ Automated Data Validation – Ensures accurate calculations based on verified origin & destination IDs.
✅ Decimal Weight Handling – Supports precise weight calculations with automatic rounding.
✅ Seamless API Workflow – Integrates with the Search Destination Endpoint for smooth data transition.

How it Works

Required Data for Simulate Calculation

To perform a shipping cost calculation, users must provide:

  1. Origin
    ID
    – Obtained from the Search Destination Endpoint.
  2. Destination
    ID
    – Also retrieved from the Search Destination Endpoint.
  3. Origin and Destination
    pinpoint
    - If you want to deliver you order into customer using the instant courier, you must filled this param's to check availability for instant delivery or maybe a one of regular shipping needed
  4. Package
    weight
    – Expressed in kilograms (kg). :::note 💡 Important: Incorrect origin or destination IDs will lead to inaccurate shipping costs. Always ensure the data is correct before making a request. :::

Handling Decimal Weights

Users often ask:

:::note 😕 “How does the system handle decimal weights?” ::: The Calculate Endpoint supports decimal weight values, which should be formatted using a dot (.) as the decimal separator. To comply with courier service standards, the system automatically rounds weights as needed, preventing errors and ensuring smooth validation.

API Processing & Response

Once all required data is submitted:

  1. The system validates the
    origin
    ,
    destination
    ,
    pinpoint
    , and
    weight
    values.
  2. The API fetches real-time shipping cost data from multiple courier services in our systems.
  3. A JSON response is returned, detailing available shipping options, prices, and simulate our store_order services for your maximize information.

Request Body

curl --location 'https://api-sandbox.collaborator.komerce.id/tariff/api/v1/calculate?shipper_destination_id=31597&receiver_destination_id=46116&weight=1&item_value=300000&cod=yes&origin_pin_point=-7.279849431298132%2C109.35114360314475&destination_pin_point=-7.30585%2C109.36814' \ --header 'x-api-key: inputapikey'

Query Parameter

Headers

KeyTypeDescription
x-api-key
stringthis Value contain an secret APIKEY identic for Shipping API

Query Parameters

KeyTypeDescription
shipper_destination_id
*
intthis Value containt an
id
during Search Destination
receiver_destination_id
*
intthis Value containt an
id
during Search Destination
origin_pin_point
*
stringthis Value contain an a geolocation from origin
latitude, longitude
address
destination_pin_point
*
stringthis Value contain an a geolocation from destination
latitude, longitude
address
weight
*
floatthis Value is an Kilogram, use dot(.) for float value
item_value
*
intthis Value is an Item Price
cod
booleanthis Value is containt an a boolean method (yes/no) method of shipping if cod=yes system will give response of Coverage Area or possibility to COD or not

Additional information for the using origin or destination,

pin_point
is used to calculate the estimated shipping cost by using instant courier. Make sure
pin_point
data submitted is in accordance with the estimated delivery from the origin location to the destination.

:::danger 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

KeyValue
meta.message
Response for searching address
meta.code
Any response have different code
meta.status
Boolean status for checking address
data.calculate_reguler
List of available couriers for regular delivery
data.calculate_cargo
List of available couriers for cargo delivery
data.calculate_instant
List of available couriers for instan or sameday delivery
data.calculate_{{servicetype}}.shipping_name
Name of the courier that can be used for delivery of goods
data.calculate_{{servicetype}}.service_name
The name of the courier delivery service that can be used to deliver goods
data.calculate_{{servicetype}}.weight
Weight of goods from request
data.calculate_{{servicetype}}.is_cod
COD delivery usage information
data.calculate_{{servicetype}}.shipping_cost
Original shipping price
data.calculate_{{servicetype}}.shipping_cashback
Discounted price on shipping costs
data.calculate_{{servicetype}}.shipping_cost_net
Shipping cost price after discount
data.calculate_{{servicetype}}.grandtotal
The total payment price that the seller gets
data.calculate_{{servicetype}}.service_fee
Value of 2.8% of
grand_total
if the package is delivered using COD payment
data.calculate_{{servicetype}}.net_income
Net income earned by the seller
data.calculate_{{servicetype}}.etd
Estimated delivery time

Success Respons for Calculate Price

{ "meta": { "message": "Success Calculate Shipping", "code": 200, "status": "success" }, "data": { "calculate_reguler": [ { "shipping_name": "NINJA", "service_name": "Standard", "weight": 5, "is_cod": true, "shipping_cost": 83000, "shipping_cashback": 37350, "shipping_cost_net": 45650, "grandtotal": 383000, "service_fee": 10724, "net_income": 326626, "etd": "-" }, { "shipping_name": "SAP", "service_name": "SAPFlat", "weight": 5, "is_cod": true, "shipping_cost": 46500, "shipping_cashback": 0, "shipping_cost_net": 46500, "grandtotal": 346500, "service_fee": 9702, "net_income": 290298, "etd": "" }, { "shipping_name": "JNE", "service_name": "REG23", "weight": 5, "is_cod": true, "shipping_cost": 80000, "shipping_cashback": 20000, "shipping_cost_net": 60000, "grandtotal": 380000, "service_fee": 10640, "net_income": 309360, "etd": "3-4 day" }, { "shipping_name": "SICEPAT", "service_name": "REG", "weight": 5, "is_cod": true, "shipping_cost": 76500, "shipping_cashback": 22950, "shipping_cost_net": 53550, "grandtotal": 376500, "service_fee": 10542, "net_income": 312408, "etd": "2-4 day" }, { "shipping_name": "IDEXPRESS", "service_name": "STD", "weight": 5, "is_cod": true, "shipping_cost": 135500, "shipping_cashback": 33875, "shipping_cost_net": 101625, "grandtotal": 435500, "service_fee": 12194, "net_income": 321681, "etd": "-" }, { "shipping_name": "LION", "service_name": "REGPACK", "weight": 5, "is_cod": false, "shipping_cost": 80000, "shipping_cashback": 16000, "shipping_cost_net": 64000, "grandtotal": 380000, "service_fee": 10640, "net_income": 305360, "etd": "3-5 day" }, { "shipping_name": "JNT", "service_name": "EZ", "weight": 5, "is_cod": true, "shipping_cost": 75000, "shipping_cashback": 18750, "shipping_cost_net": 56250, "grandtotal": 375000, "service_fee": 10500, "net_income": 308250, "etd": "-" } ], "calculate_cargo": [ { "shipping_name": "SAP", "service_name": "DRGREG", "weight": 5, "is_cod": true, "shipping_cost": 52500, "shipping_cashback": 15750, "shipping_cost_net": 36750, "grandtotal": 352500, "service_fee": 9870, "net_income": 305880, "etd": "3-5 day" }, { "shipping_name": "JNE", "service_name": "JTR23", "weight": 5, "is_cod": true, "shipping_cost": 50000, "shipping_cashback": 1250, "shipping_cost_net": 48750, "grandtotal": 350000, "service_fee": 9800, "net_income": 291450, "etd": "3-4 day" }, { "shipping_name": "SICEPAT", "service_name": "GOKIL", "weight": 5, "is_cod": true, "shipping_cost": 60000, "shipping_cashback": 3000, "shipping_cost_net": 57000, "grandtotal": 360000, "service_fee": 10080, "net_income": 292920, "etd": "3-5 day" }, { "shipping_name": "IDEXPRESS", "service_name": "Idtruck", "weight": 5, "is_cod": true, "shipping_cost": 42500, "shipping_cashback": 850, "shipping_cost_net": 41650, "grandtotal": 342500, "service_fee": 9590, "net_income": 291260, "etd": "-" }, { "shipping_name": "LION", "service_name": "BIGPACK", "weight": 5, "is_cod": false, "shipping_cost": 90000, "shipping_cashback": 18000, "shipping_cost_net": 72000, "grandtotal": 390000, "service_fee": 10920, "net_income": 307080, "etd": "3-7 day" } ], "calculate_instant": [ { "shipping_name": "GOSEND", "service_name": "Instant", "weight": 5, "is_cod": false, "shipping_cost": 9500, "shipping_cashback": 0, "shipping_cost_net": 9500, "grandtotal": 309500, "service_fee": 0, "net_income": 300000, "etd": "1-2 hours" } ] } }

Error Respons for Calculate Price

{ "meta": { "message": "Success Calculate Shipping", "code": 200, "status": "success" }, "data": { "calculate_reguler": [], "calculate_cargo": [], "calculate_instant": [] } }

:::warning This response can occur if only the parameters

shipper_destination_id
,
receiver_destination_id
,
origin_pin_point
, and
destination_pin_point
are not filled in during the request. :::

Error Code

CodeStatusDescriptionHow To Fix
400
Bad requestThe request parameter has an errorCheck the desired request parameters again, this usually happens because there is a mismatch between the request and the expectations of the request that occurred.
401
UnauthorizedAPI key invalid or missing from parameterMake sure your API key is valid using your Account
422
Unprocessable EntityKeywoard parameter is missingAdd an valid keywoard parameter in your requested query. Parameter Request can't be null or missing
500
---

Tips to Avoid Errors

Ensure required parameters are present:

  • shipper_destination_id
    &
    receiver_destination_id
    → this value you can get from Search_destination EndPoint when you searching the origin or destination address using District/SubDistrict/PostalCode. This value can helping you to get more information about Regular or Cargo Shipping.
  • origin_pin_point
    &
    destination_pin_point
    → this value you can get from ThirdParty maps to ensure identic pinpoint for origin and destination address for using InstantDelivery like GoSend, etc.
  • weight
    → the total weight of the items (in Calculate EndPoint this value using an grams).
  • item_value
    → the total value of the items (in IDR currency), this value can helping you to understand when using store_order parameter and describe more value to using the service.