Skip to main content

createOrder

Creating an order in the order storage 🔐 This method requires authorization.

Orders.createOrder(marker, body, langCode)

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

const value = await Orders.createOrder('my-order', body)
Schema

marker:* string
Textual identifier of the order storage object
example: my-order

body:* IOrderData
Object for creating an order
example:

langCode: String
Optional language field
example: en_US


Schema (body)

formIdentifier: string
text identifier of the form object linked to the order storage
example: bars

paymentAccountIdentifier: string
text identifier of the payment object linked to the order storage
example: payment1

statusIdentifier: string
text identifier of the order status object (if not specified, the default status will be assigned)
example: inprogress

formData: FormDataType
data submitted by the form linked to the order store
example:

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

products Record<string, string | any>[]
array of products added to order

productId: number
product identifier
example: 12

quantity: number
quantity of the product
example: 1

This method retrieves one order storage object by marker. The method will add the default language to the request body. If you want to change the language, just pass it with the second argument

Example return:

{
"formIdentifier": "bars",
"paymentAccountIdentifier": "payment1",
"statusIdentifier": "inprogress",
"formData": [
{
"marker": "marker_1",
"type": "string",
"value": "Name"
}
],
"products": [
{
"productId": 1,
"quantity": 2
},
{
"productId": 2,
"quantity": 3
}
],
"createdDate": "2024-06-21T09:42:54.848Z",
"currency": "USD",
"totalSum": 345
}
Schema

statusIdentifier: string
text identifier of the order status
example: inprogress

formIdentifier: string
text identifier of the form status
example: order-form

paymentAccountIdentifier string
text identifier of the order payment
example: payment-1

formData FormDataType
data submitted by the form linked to the order store
example:

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

products Record<string, string | any>[]
array of products added to order

totalSum string
total order amount
example: 12.00

currency string
currency used to pay for the order
example: USD

createdDate string
date when the order was created
example: 2023-01-01 12:12