Update Draft Order
POST /v1/draft_orders/:id
You can update the draft order as long as it is not confirmed using Confirm Draft Order API yet. With this you can change the courier information, user information, etc. This endpoints also necessary if you want to make the draft order to be ready to confirm if you don't specify the courier information during Create Draft Order.
API Parameters
Show child parameters
pickup your package will be picked by courier based on origin that you specify.
drop_off you must drop off the package to the nearest courier agent.
Show child parameters
7_days you will receiver your money 7 days after the item is delivered.
5_days you will receiver your money 5 days after the item is delivered.
3_days you will receiver your money 3 days after the item is delivered.
now will generate waybill instantly and pickup right away.
scheduled will generate waybill instantly and pickup based on delivery date and delivery time.
Show child parameters
Value | Description |
---|---|
fashion | Clothing, accessories, and personal adornments. |
healthcare | Products related to health, wellness, and personal care. |
food_and_drink | Items related to food and beverages. |
electronic | Electronic devices and accessories. |
beauty | Beauty products and cosmetics. |
outdoor_gear | Equipment and apparel for outdoor activities. |
home_accessories | Items that enhance the decor and functionality of the home. |
hobby | Products related to leisure and hobbies. |
collection | Items that belong to a particular collection or set. |
sparepart | Replacement parts and accessories. |
groceries | Food and household items typically purchased for regular consumption. |
others | Miscellaneous items that don't fit into the other categories. |
Type of Request
Set courier
If you want to set the courier for the draft order, make sure you call
the get the courier rates using Retrieve Draft Order Rates API.
The only courier_company
and courier_type
value that are supported are the one that are displayed on the Retrieve Draft Order Rates API response.
Once you have selected the courier company and the courier type, the draft order status is automatically updated to "ready" status. Once the status is ready, you can confirm the Draft Order using Confirm Draft Order API and the order will be created.
{
"courier_company": "sicepat",
"courier_type": "reg"
}
Set origin and destination
This endpoint can be used to change the origin and destination information, for example, if previously the origin and destination are defined with postal code, it can be changed to coordinate.
Upon changing, if the courier_company
and courier_type
already set, and
it's instant courier, but the origin or destination are set to other than
coordinate, it will nullify the courier_company
and courier_type
, hence the
draft order status will be placed
.
{
"origin_coordinate": {
"latitude": -6.1751,
"longitude": 106.8650
},
"destination_coordinate": {
"latitude": -6.2115,
"longitude": 106.8452
}
}
When you send origin and destination value, you must at least choose one type of origin or destination. Origin and destination must at least have postal codes, coordinates or area ids. You do not need to insert all of the three values.
API Response
Updated
{
"success": true,
"code": 20011003,
"object": "draft_order",
"id": "ef18275c-02a9-4887-a56b-f374edb96ec4",
"order_id": null,
"origin": {
"area_id": "IDNP6IDNC148IDND836IDNZ12430",
"address": "CITOS - Cilandak Town Square, Kota Jakarta Selatan, Jakarta 12430",
"note": null,
"contact_name": "John Doe",
"contact_phone": "081234567901",
"contact_email": "[email protected]",
"coordinate": {
"latitude": null,
"longitude": null
},
"province_name": "DKI Jakarta",
"city_name": "Jakarta Selatan",
"district_name": "Cilandak",
"postal_code": 12430,
"collection_method": "pickup"
},
"destination": {
"area_id": "IDNP6IDNC147IDND835IDNZ10210",
"address": "Jl. Contoh No. 12",
"note": null,
"contact_name": "Jake Doe",
"contact_phone": "0812345678902",
"contact_email": "[email protected]",
"coordinate": {
"latitude": null,
"longitude": null
},
"province_name": "DKI Jakarta",
"city_name": "Jakarta Pusat",
"district_name": "Tanah Abang",
"postal_code": 10210,
"proof_of_delivery": {
"use": false,
"fee": 0,
"note": null,
"link": null
},
"cash_on_delivery": {
"payment_method": null,
"amount": null,
"amount_currency": "IDR",
"note": null,
"type": null
}
},
"courier": {
"name": null,
"phone": null,
"company": "sicepat",
"type": "reg",
"link": null,
"tracking_id": null,
"waybill_id": null,
"insurance": {
"amount": 0,
"amount_currency": "IDR",
"fee": 0,
"fee_currency": "IDR",
"note": ""
},
"routing_code": null
},
"delivery": {
"type": "now",
"datetime": "2024-09-19T03:40:22.810Z",
"note": null,
"distance": null,
"distance_unit": "kilometer"
},
"extra": [],
"tags": [],
"metadata": null,
"items": [
{
"name": "Black Leather Bag",
"description": "Goods",
"value": 30,
"quantity": 1,
"height": 1,
"width": 1,
"length": 1,
"weight": 1
}
],
"currency": "IDR",
"tax_lines": [],
"price": 11500,
"status": "ready",
"reference_id": "example/35ef876e-3902-4186-873a-e9012ea1e354",
"invoice_id": "1209839012839012",
"user_id": "6448e9d77ff7510bbadfa605",
"created_at": "2024-09-19T03:40:22.802Z",
"updated_at": "2024-09-19T03:40:22.802Z",
"placed_at": null,
"ready_at": "2024-09-19T03:40:22.802Z",
"confirmed_at": null,
"deleted_at": null
}