Update Order
This API endpoint allows you to update an existing order based on the provided orderId.
HTTP Request
- URL:
/orders/{orderId} - Method:
PUT - Headers:
Content-Type:application/jsonaccessToken: Required. This is your access token for authenticating the request.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
orderId | String | The unique identifier of the order to update. |
Request Body
The request body should be a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
paymentStatus | String | Status of the payment (e.g., "paid"). |
orderStatus | String | Status of the order (e.g., "fulfilled"). |
fulfilledItems | Array of Objects | List of items fulfilled, including carrier and tracking details. |
taxAmount | Number | Amount of tax applied to the order. |
billingAddress | String | ID of the billing address. |
ShippingAddressId | String | ID of the shipping address (if applicable). |
newShippingAddress | Object | Details of a new shipping address, if applicable. |
refundedAmount | Number | Amount refunded for the order. |
shippingCost | Number | Cost of shipping. |
currency | Object | Currency details with code and symbol. |
metaFields | Array of Objects | Custom metadata fields for the order. |
paymentTerm | ID | Id of payment term assigned for that company |
lineItems | Array of Objects | List of line items in the order, including discounts and fulfillment details. |
Fulfilled Items
| Field | Type | Description |
|---|---|---|
items | Array of Objects | List of fulfilled items with quantities. |
carrier | String | Carrier used for shipping. |
trackingNumber | String | Tracking number provided by the carrier. |
fulfilledAt | String | Date of fulfillment (YYYY-MM-DD format). |
Items in Fulfilled Items
| Field | Type | Description |
|---|---|---|
lineItemId | String | ID of the line item. |
quantity | String | Quantity of the item fulfilled. |
New Shipping Address
| Field | Type | Description |
|---|---|---|
companyName | string | Company name of this contact (Optional). |
companyEmail | string | Company email of the contact (Optional). |
firstName | String | First name of the recipient. |
lastName | String | Last name of the recipient. |
phoneNumber | String | Contact phone number. |
address1 | String | Primary address line. |
address2 | String | Secondary address line (optional). |
city | String | City of the address. |
state | String | State of the address. |
country | String | Country code of the address. |
zipcode | String | Zip or postal code. |
Currency
| Field | Type | Description |
|---|---|---|
currency | String | Currency code. |
symbol | String | Currency symbol. |
MetaFields
| Field | Type | Description |
|---|---|---|
code | String | Code for metadata field. |
value | String | Value of metadata field. |
Line Items
| Field | Type | Description |
|---|---|---|
id | String | ID of the line item. |
productId | String | ID of the product. |
variantId | String | ID of the product variant. |
discountAmount | String | Amount of discount applied. |
quantity | Number | Quantity of the product. |
price | Number | Price of the product. |
fulfilledQuantity | Number | Quantity of the product that has been fulfilled. |
returned | Boolean | Whether the item has been returned. |
Sample Payload
{
"paymentStatus": "paid",
"orderStatus": "fulfilled",
"fulfilledItems": [
{
"items": [
{ "lineItemId": "637727d2c6aef8f9662bc3db", "quantity": "2" },
{ "lineItemId": "637cdcda4e71ed1db40e910f", "quantity": "5" }
],
"carrier": "something",
"trackingNumber": "8498461648",
"fulfilledAt": "2022-10-20"
}
],
"taxAmount": 0,
"billingAddress": "63356b3b3a6353a69043680b",
"ShippingAddressId": "",
"newShippingAddress": {
"firstName": "Prashanth",
"lastName": "Viru",
"phoneNumber": "65161861",
"address1": "12/4, test st",
"address2": "",
"city": "Elizabeth",
"state": "NJ",
"country": "US",
"zipcode": "07202"
},
"refundedAmount": 0,
"shippingCost": 0,
"currency": {
"currency": "$",
"symbol": "$"
},
"metaFields": [{ "code": "orderId", "value": "#123445363" }],
"lineItems": [
{
"id": "637727d2c6aef8f9662bc3db",
"productId": "",
"variantId": "",
"discountAmount": "10",
"quantity": 2,
"price": 100,
"fulfilledQuantity": 1,
"returned": false
},
{
"id": "637cdcda4e71ed1db40e910f",
"productId": "",
"variantId": "",
"discountAmount": "5",
"quantity": 5,
"price": 55,
"fulfilledQuantity": 3,
"returned": false
}
]
}
Response
- Status Code: 200 Created
Success Response Body
{
"success": true,
"message": "Order updated successfully",
"data": {
"id": "<Order ID>"
//...
}
}
Success Response Structure
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful. |
message | string | Provides a descriptive message about the outcome. |
data | object | Contains the details of the newly created order. Defines in Order Object. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure that the
accessTokenis valid and not expired. - Ensure all required fields are filled according to your business rules when updating the order.