Skip to main content

updateOrderByMarkerAndId

Update an order in an order storage. 🔐 This method requires authorization.

Description​

Updates an order found by storage marker and order id, and resolves to the updated order as an IBaseOrdersEntity.

As in createOrder, the SDK sends formData under a language key: the langCode set in defineOneEntry by default, or the fourth argument.

.updateOrderByMarkerAndId(

, , ,

);

Parameters schema​

Schema

marker(required): string
Marker of the order storage.
example: "order_storage_1"

id(required): number
Order ID.
example: 12345

body(required): IOrderData
Data for updating the 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
Marker of the form linked to the order storage.
example: "bar-orders-form"

body.paymentAccountIdentifier(required): string
Marker of the payment account linked to the order storage.
example: "payment-1"

body.formData(required): IOrdersFormData | IOrdersFormData[]
Data from the form linked to the order storage.
example:

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

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

formData.type(required): string
Type of the field value, for example "string".
example: "string"

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

body.products(required): IOrderProductData[]
Ordered products.
example: []

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

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

products.signedPrice: string
Signed token (JWT) that fixes the product price for an order. Returned when signPrice is set.
see: Fixed product price
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

body.couponCode: string
Coupon code.

body.additionalDiscountsMarkers: string[]
Markers of additional discounts to apply.

body.bonusAmount: number
Bonus amount to apply.

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

signedPrice is a signed token that carries the locked price. Pass it back when you create or update an order. See Fixed product price (signedPrice).

Examples​

Minimal example​


const body = {
,
,
{
,
,
}
],
{
,
}
]
};

const response = await Orders.updateOrderByMarkerAndId("my_order", 55, body);

Example with a fixed price (signedPrice)​

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


const products = await Products.([], "en_US", {
signPrice: "my_order"
});
if ('statusCode' in products) throw new Error(products.message);
const { items } = products;

const body = {
,
,
],
{
"productId": items[0].,
,
"signedPrice": items[0].
}
]
};

const response = await Orders.updateOrderByMarkerAndId("my_order", 55, body);

Example response​

{
"id": 55,
"formIdentifier": "orderForm",
"paymentAccountIdentifier": "cash",
"formData": [
{
"marker": "order_name",
"value": "John",
"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-payment",
"statusLocalizeInfos": {
"title": "In progress"
}
}

Response schema​

Schema: IBaseOrdersEntity

id: number
Object ID.
example: 1

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

paymentAccountIdentifier: string
Marker of the payment account.
example: "payment-1"

formData: IOrdersFormData[]
Data from the form linked to the order storage.
example:

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

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

formData.type: string
Type of the field value, for example "string".
example: "string"

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

products: IOrderProductsData[]
Products in the order.
example:

[
{
"productId": 2957,
"quantity": 2
}
]

products.productId: number
Product ID.
example: 1

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

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

totalSum: number
Total order amount.
example: 150

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

statusIdentifier: string
Marker of the order status. When omitted, the default status is assigned.
example: "status-1"

statusLocalizeInfos: ILocalizeInfo
Localized status name assigned to the created/updated order.

couponCode: string
Coupon code applied to the order.

discountConfig: IOrderDiscountConfig
Resolved discount configuration applied to the order.

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

discountConfig.coupon: unknown | null
Applied 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 additional 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 requested for redemption. The amount actually applied is in bonusApplied.

bonusApplied: number
Bonus amount applied to the order.

totalDue: number
Total due after bonuses.