Update Order


This endpoint is used to update the order.

{info} We can only update the order when it has the status "on_hold". It cannot be updated after that

Basic Information

  • Method: PUT
  • URI: /orders
  • Request Format: JSON
  • Response Format: JSON

Headers

The following headers should be sent along with the request

  • Accept: application/json
  • Authorization: Your API Key

Request

Below table list the request parameters which can be sent to create order API in JSON format

{info} The request parameters should be sent as a JSON object in the request body

Parameter Type Required Description
order_id String Yes Must be a valid order id
order_items Array of Objects Yes Details of the SKUs ordered. Please check order items table below for the details of a single order item.
payment_method String Yes The payment method used in the order. Allowed values: "prepaid", "postpaid"
shipping_address Object Yes Shipping address of the customer. Please check shipping address table below for the details of the object
billing_address Object No Same as shipping address, except that it's not required. Please check shipping address table below for the details of the object.
order_created_at String No The timestamp when the order was created in ISO 8601 format. For example: "2023-07-28T09:00:00Z"
invoice Object No Invoice details including currency, subtotal, shipping prices, taxes, discounts, and payment information. Please check invoice table below for the details of the object
customer Object No An object containing all the details of the customer. Please check customer table below for the details of the object
shipment Object No An object containing all the details of the shipment. Please check shipment table below for the details of the object
is_cash_on_delivery Boolean No Indicates if the order is cash on delivery.
require_shipping Boolean No Indicates if shipping is required for the order.
note String No Additional notes or instructions for the order.


"order_items" object

Parameter Type Required Description
sku_code String Yes Must be a valid sku code associated.
name String No The name of the item.
display_price Number No The displayed price of the item.
selling_price Number No The selling price of the item.
is_substituted Boolean No Indicates if the item is substituted.
quantity Integer No The quantity of the item in the order.
tax_percent Number No The tax percentage for the item.
tax Number No The tax amount for the item.
unit_price Number No The unit price of the item.
subtotal Number No The subtotal amount for the item(unit price * quantity).
total Number No The total amount for the item(subtotal + tax - discount).
discount Number No The discount applied to the item.
tax_inclusive Boolean No Indicates if tax is included in the item's price.


"shipping_address" object

Parameter Type Required Description
address1 String Yes Complete address of the customer
city String Yes City of the customer
country String No Country of the customer
country_code String No Country code of the customer
state String No State from where the customer belongs
state_code String No State code. For example: "NY"
first_name String No First name of the customer
last_name String No Last name of the customer
phone String No Phone number of the customer
latitude Number No Latitude of the customer's location
longitude Number No Longitude of the customer's location


"invoice" object

Parameter Type Required Description
currency String No The currency code of the amount paid. For example: "USD"
subtotal Number No Subtotal amount
shipping_price Number No Shipping price of the order
shipping_refund Number No Shipping refund amount (if applicable)
tax Number No Tax amount applied on the order
discount Number No Discount applied on the order (if any)
total Number No Total amount of the order
total_paid Number No Amount paid till now by the customer
total_due Number No Amount due from the customer
total_refunded Number No Amount refunded to the customer
payment_method String No Payment method used for the payment. For example: "Credit Card"
tax_percent Number No Percentage of tax applied on the order
shipping_tax Number No Percentage of tax applied on the shipment
sub_total_tax_inclusive Boolean No Indicates if the sub_total amount includes tax amount or not
sub_total_discount_inclusive Boolean No Indicates if the sub_total amount includes discount amount or not
shipping_tax_inclusive Boolean No Indicates if the shipment amount includes tax or not
shipping_discount_inclusive Boolean No Indicates if the shipment amount includes discount or not


"customer" object

Parameter Type Required Description
first_name String No First name of the customer
last_name String No Last name of the customer
mobile String No Mobile number of the customer
mobile_code String No Mobile number code of the customer
email String No Email address of the customer. Must be a valid email address
avatar URL No Avatar / Profile Picture URL of the customer
gender String No Gender of the customer


"shipment" object

Parameter Type Required Description
shipping_partner_name String No The name of the shipping partner responsible for delivering the order. For example, "CourierX".
shipping_partner_tag String No A tag or identifier associated with the shipping partner. It can be used for internal reference or mapping purposes.
awb_number String No AWB stands for "Air Way Bill," which is a unique number assigned to each shipment for tracking purposes. It helps in identifying and tracing the shipment throughout its journey.
awb_label String No A URL pointing to an image or document representing the AWB label. This label may include details like the AWB number, shipping partner's logo, and other relevant information.
tracking_link String No A URL pointing to a tracking page where customers can monitor the progress of their shipment. Clicking on this link could lead to a page displaying real-time tracking updates, estimated delivery time, and other related information.


Sample Request

URL:

https://dev-fc-api.aymakan.net/api/v1/orders


Body:

{
    "order_id": "diks-488392234223123",
    "order_created_at": "2023-07-28T09:00:00Z",
    "order_items": [
        {
            "sku_code": "SKU-AC-47",
            "name": "TV",
            "display_price": 799,
            "selling_price": 699,
            "is_substituted": false,
            "quantity": 1,
            "tax_percent": 10,
            "tax": 69.9,
            "unit_price": 699,
            "subtotal": 699,
            "total": 768.9,
            "discount": 100,
            "tax_inclusive": true
        }
    ],
    "billing_address": {
        "address1": "123 Main Street",
        "city": "New York",
        "country": "United States",
        "first_name": "John",
        "last_name": "Doe",
        "phone": "123-456-789",
        "state": "NY",
        "zip": "10001",
        "state_code": "vjk",
        "country_code": "US",
        "latitude": 40.7128,
        "longitude": -74.0060
    },
    "shipping_address": {
        "address1": "456 Elm Street",
        "city": "Los Angeles",
        "country": "United States",
        "first_name": "Jane",
        "last_name": "Smith",
        "phone": "987-654-3210",
        "state": "CA",
        "zip": "90001",
        "state_code": "CA",
        "country_code": "US",
        "latitude": 34.0522,
        "longitude": -118.2437
    },

    "invoice": {
        "currency": "USD",
        "subtotal": 699,
        "shipping_price": 0,
        "shipping_refund": 0,
        "tax": 69.9,
        "discount": 100,
        "total": 768.9,
        "total_paid": 768.9,
        "total_due": 0,
        "total_refunded": 0,
        "payment_method": "Credit Card",
        "tax_percent": 10,
        "shipping_tax": 0,
        "sub_total_tax_inclusive": true,
        "sub_total_discount_inclusive": true,
        "shipping_tax_inclusive": false,
        "shipping_discount_inclusive": false
    },
    "customer": {
        "first_name": "John",
        "last_name": "Doe",
        "mobile": "1234567890",
        "mobile_code": "+1",
        "email": "[email protected]",
        "avatar": "https://example.com/avatar.jpg",
        "gender": "male"
    },
    "shipment": {
        "shipping_partner_name": "CourierX",
        "shipping_partner_tag": "courierx123",
        "awb_number": "AWB-456",
        "awb_label": "https://example.com/awb-label.jpg",
        "tracking_link": "https://example.com/tracking/456"
    },
    "payment_method": "prepaid",
    "is_cash_on_delivery": false,
    "require_shipping": true,
    "note": "Please deliver during weekdays",
    "meta_data": {
        "name": "Metadata",
        "has_options": true
    }
}

Response

Sample response is added here:


Validation Error:
The HTTP response code will be 422 in this case

{
    "success": false,
    "message": "Validation Error",
    "data": null,
    "meta": null,
    "validation_errors": {
        "order_id": "The order id field is required."
    }
}


Success:

{
    "success": true,
    "message": "Order saved successfully",
    "data": {
        "order_id": "diks-488392234223123",
        "status": "On Hold",
        "hub_code": "ollkomHub",
        "customer": {
            "id": "",
            "first_name": "John",
            "last_name": "Doe",
            "mobile": "1234567890",
            "mobile_code": "+1",
            "email": "[email protected]",
            "avatar": "https://example.com/avatar.jpg",
            "gender": "male"
        },
        "seller_name": "Ollkom Store",
        "order_alias": "",
        "order_items": [
            {
                "id": "657864d5855c9ba8541bc37d",
                "seller_sku_code": "SKU-AC-47",
                "display_price": 0,
                "selling_price": 699,
                "is_substituted": false,
                "substitute_seller_sku_codes": null,
                "serialised_sku_codes": null,
                "item_barcodes": null,
                "quantity": 1,
                "tax_percent": 10,
                "tax": 69.9,
                "reason": "",
                "picked_quantity": 0,
                "packed_quantity": 0,
                "unit_price": 0,
                "total": 768.9,
                "tax_inclusive": false,
                "discount": 0
            }
        ],
        "total_item_count": 1,
        "total_sku_count": 1,
        "total": 1,
        "billing_address": {
            "address1": "123 Main Street",
            "address2": "",
            "city": "New York",
            "country": "United States",
            "first_name": "John",
            "last_name": "Doe",
            "phone": "123-456-789",
            "state": "NY",
            "zip": "10001",
            "state_code": "vjk",
            "country_code": "US",
            "latitude": 40.7128,
            "longitude": -74.006
        },
        "shipping_address": {
            "address1": "456 Elm Street",
            "address2": "",
            "city": "Los Angeles",
            "country": "United States",
            "first_name": "Jane",
            "last_name": "Smith",
            "phone": "987-654-3210",
            "state": "CA",
            "zip": "90001",
            "state_code": "CA",
            "country_code": "US",
            "latitude": 34.0522,
            "longitude": -118.2437,
            "google_address": "",
            "google_place_id": 0,
            "google_place_name": "",
            "omniful_country_id": 12,
            "omniful_country": "United States of America",
            "omniful_state_id": 0,
            "omniful_state": "",
            "omniful_city_id": 0,
            "omniful_city": "",
            "postal_code": "",
            "google_latitude": 0,
            "google_longitude": 0,
            "google_address_category": ""
        },
        "reason": "Sku not Valid",
        "cancelled_reason": "",
        "sub_status": "",
        "transactions": [
            {
                "created_at": "2023-12-12T13:49:09.819333614Z",
                "ahmount": 699,
                "type": 4,
                "card_number": "",
                "source_account": "",
                "destination_account": "",
                "status": 2,
                "description": ""
            }
        ],
        "slot": {
            "delivery_date": "",
            "start_time": 0,
            "end_time": 0
        },
        "order_created_at": "2023-07-28T09:00:00Z",
        "invoice": {
            "currency": "USD",
            "subtotal": 699,
            "shipping_tax": 0,
            "sub_total_tax_inclusive": true,
            "sub_total_discount_inclusive": true,
            "shipping_tax_inclusive": false,
            "shipping_discount_inclusive": false,
            "shipping_price": 0,
            "shipping_refund": 0,
            "tax": 69.9,
            "tax_percent": 10,
            "discount": 100,
            "total": 768.9,
            "total_paid": 768.9,
            "total_due": 0,
            "total_refunded": 0,
            "payment_method": "",
            "loyalty_discount": 0,
            "wallet_amount": 0
        },
        "shipment": {
            "shipment_created_at": "0001-01-01T00:00:00Z",
            "order_delivered_at": "0001-01-01T00:00:00Z",
            "order_shipped_at": "0001-01-01T00:00:00Z",
            "shipping_partner_order_id": "",
            "awb_number": "",
            "shipping_partner_status": "",
            "awb_label": "",
            "shipping_partner_tag": "",
            "shipping_partner_name": "",
            "shipment_id": "",
            "shipping_options": [
                "manual_dispatch",
                "shipping_partner"
            ],
            "number_of_boxes": 0
        },
        "delivery_type": "express_delivery",
        "payment_method": "Prepaid",
        "shipment_created_at": "0001-01-01T00:00:00Z",
        "order_shipped_at": "0001-01-01T00:00:00Z",
        "order_delivered_at": "0001-01-01T00:00:00Z",
        "meta_data": {
            "is_update_order_allowed": false
        }
    },
    "meta": null
}