Skip to main content

updateOrderByMarkerAndId

Order modification in the order storage. 🔐 This method requires authorization.

Description

This method updates a single order inside the specified order storage by its marker and id. It returns a Promise that resolves to an IBaseOrdersEntity object with the updated order.

Orders.updateOrderByMarkerAndId(

marker*, id*, body*, langCode

);

Parameters schema

Schema

marker(required): string
The text identifier of the order storage object
example: "order_storage_1"

id(required): number
ID of the order object
example: 12345

body(required): IOrderData
Object for updating an order
example:

{
"formIdentifier": "bar-orders-form",
"paymentAccountIdentifier": "usd-payment",
"formData": {
"marker": "name_1",
"value": "Name",
"type": "string"
},
"products": [
{
"productId": 1,
"quantity": 2
}
],
"currency": "USD"
}

body.formIdentifier(required): string
Text identifier of the form object linked to the order repository.
example: "bar-orders-form"

body.paymentAccountIdentifier(required): string
Text identifier of the payment object linked to the order repository.
example: "payment-1"

body.formData(required): IOrdersFormData | IOrdersFormData[]
Form data linked to the order repository.
example:

[
{
"marker": "name_1",
"value": "Name",
"type": "string"
}
]

formData.marker(required): string
Marker of form field.
example: "name_1"

formData.type(required): string
Type of value.
example: "string"

formData.value(required): string
Value.
example: "Name"

body.products(required): IOrderProductData[]
An array of ordered products.
example: []

products.productId(required): number
Product identifier.
example: 1

products.quantity(required): number
Quantity of the product.
example: 2

products.signedPrice: string
The signed price of the product is obtained along with the product data when signPrice is set.
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

body.couponCode: string
Coupon code.

body.additionalDiscountsMarkers: string[]
Array of additional discount markers.

body.bonusAmount: number
Bonus amount to apply.

langCode: string
Language code. Default: "en_US"
example: "en_US"

🔒 signedPrice is the signed token that carries the locked price — pass it back when you create an order. See Fixed product price (signedPrice).

Examples

Minimal example


const body = {
"formIdentifier": "orderForm",
"paymentAccountIdentifier": "cash",
"formData": {
{
"marker": "order_name",
"type": "string",
"value": "Ivan"
}
},
"products": [
{
"productId": 2,
"quantity": 2
}
]
};

const response = await Orders.updateOrderByMarkerAndId("my-order", 1, body);

Example with a fixed price (signedPrice)

Pass each product's signedPrice token (obtained when the products were fetched with signPrice set) so the updated order keeps the locked price:


const { items } = await Products.getProducts([], "en_US", {
signPrice: "my-order"
});

const body = {
"formIdentifier": "orderForm",
"paymentAccountIdentifier": "cash",
"formData": [],
"products": [
{
"productId": items[0].id,
"quantity": 2,
"signedPrice": items[0].signedPrice
}
]
};

const response = await Orders.updateOrderByMarkerAndId("my-order", 1, body);

Example response

{
"id": 55,
"formIdentifier": "orderForm",
"paymentAccountIdentifier": "cash",
"formData": [
{
"marker": "order_name",
"value": "Ivan",
"type": "string"
}
],
"products": [
{
"productId": 2957,
"quantity": 2
}
],
"currency": "USD",
"totalSum": 285,
"bonusApplied": 0,
"totalDue": 285,
"discountConfig": {
"orderDiscounts": [
{
"id": 2,
"identifier": "personal_discount",
"type": "PERSONAL_DISCOUNT",
"localizeInfos": {
"title": "Personal discount"
},
"startDate": "2026-04-21T18:26:19.815Z",
"endDate": "2028-03-21T19:26:24.741Z",
"discountValue": {
"value": 15,
"maxAmount": null,
"discountType": "FIXED_AMOUNT",
"applicability": "TO_ORDER"
},
"exclusions": null,
"position": 1,
"conditionLogic": "AND",
"gifts": [],
"userGroups": null,
"userExclusions": null,
"conditions": [],
"coupon": null
}
],
"productDiscounts": [],
"coupon": null,
"settings": {
"allowStacking": true,
"maxDiscountValue": 50,
"allowGiftStacking": false,
"maxBonusPaymentPercent": null,
"minBonusAmount": null,
"minOrderAmountForBonus": null,
"giftRefundPolicy": "KEEP_GIFT"
},
"additionalDiscountsMarkers": [],
"totalRaw": 300,
"totalSumWithDiscount": 285,
"excludedGiftProductIds": [],
"bonus": null,
"bonusApplied": 0,
"totalDue": 285
},
"statusIdentifier": "inProgress",
"statusLocalizeInfos": {
"title": "In progress"
}
}

Response schema

Schema: IBaseOrdersEntity

id: number
Object identifier.
example: 1

formIdentifier: string
Text identifier of the form.
example: "bar-orders-form"

paymentAccountIdentifier: string
Text identifier of the order payment.
example: "payment-1"

formData: IOrdersFormData[]
Data submitted by the form linked to the order store.
example:

[
{
"marker": "name_1",
"value": "Name",
"type": "string"
}
]

formData.marker: string
Marker of form field.
example: "name_1"

formData.type: string
Type of value.
example: "string"

formData.value: string
Value.
example: "Name"

products: IOrderProductsData[]
Array of products added to order.
example:

[
{
"id": 2957,
"title": "Cosmo",
"sku": null,
"previewImage": null,
"price": 150,
"quantity": 2
}
]

products.productId: number
Product identifier.
example: 1

products.quantity: number
Quantity of the product.
example: 2

currency: string
Currency used to pay for the order.
example: "USD"

totalSum: string
Total order amount.
example: "150"

createdDate: string
Order creation date.
example: "2023-10-01T12:00:00Z"

statusIdentifier: string
Text identifier of order status object (if not set, default status will be assigned).
example: "status-1"

couponCode: string
**

discountConfig: IOrderDiscountConfig
Resolved discount configuration applied to the order.

discountConfig.bonus: IOrderDiscountBonus | null
Bonus calculation result, null when bonuses are not used, or omitted entirely when the order has no bonus context.

discountConfig.coupon: unknown | null
Resolved coupon, or null when no coupon is applied.

discountConfig.orderDiscounts: unknown[]
Order-level discounts that were matched and applied.

discountConfig.productDiscounts: unknown[]
Product-level discounts that were matched and applied.

discountConfig.settings: IOrderDiscountSettings
Stacking and cap settings used during calculation.

discountConfig.additionalDiscountsMarkers: string[]
Markers of extra discounts requested by the client (omitted in preview responses).

discountConfig.bonusApplied: number
Bonus amount applied to the order (omitted in preview responses).
example: 0

discountConfig.excludedGiftProductIds: string[]
Product ids excluded from gift selection (omitted in preview responses).

discountConfig.totalDue: number
Total amount due after discounts and bonuses (omitted in preview responses).
example: 300

discountConfig.totalRaw: number
Total amount before discounts (omitted in preview responses).
example: 300

discountConfig.totalSumWithDiscount: number
Total amount after discounts but before bonuses (omitted in preview responses).
example: 300

bonusAmount: number
Bonus amount applied to the order.

bonusApplied: number
Bonus applied to the order.

totalDue: number
Total due after bonuses.