Skip to main content

Create an order

Creates an order directly on the platform, without going through the checkout flow.

customerId must refer to an existing customer, and shippingAddress is required. billingAddress is optional and defaults to the shipping address when omitted.

Each row needs a productId and a quantity. Leave totalPrice out to let the platform price the row using the customer's price list and applicable campaigns, or set it explicitly to keep the price from the originating system. When you set priceExcludingTax without a taxAmount, the tax is calculated from the applicable VAT rules.

note

Ensure that the authorization token with the correct admin privileges are included in the header

Request:

mutation createOrder {
createOrder(input: {
customerId: 316
externalId: "POS-88213"
shippingAddress: {
firstName: "Erik"
lastName: "Svensson"
streetAddress: "Järnvägsgatan"
houseNumber: "11"
postalCode: "66133"
city: "Säffle"
countryCode: "SE"
phone: "+46730000000"
}
rows: [
{ productId: "P12345", quantity: 2, totalPrice: { priceExcludingTax: 160.0, taxAmount: 40.0 } },
{ productId: "P67890", quantity: 1 }
]
}) {
id
createdAt
externalId
customer {
id
}
rows {
id
quantity
product {
name {
value
}
}
totalPrice {
priceExcludingTax
}
}
totals {
price {
priceExcludingTax
}
}
}
}

Response:

{
"data": {
"createOrder": {
"id": 341,
"createdAt": "2024-05-08T08:22:11Z",
"externalId": "POS-88213",
"customer": {
"id": 316
},
"rows": [
{
"id": 671,
"quantity": 2,
"product": {
"name": [
{
"value": "Pioneer, DV-585A, DVD-spelare"
}
]
},
"totalPrice": {
"priceExcludingTax": 160
}
},
{
"id": 672,
"quantity": 1,
"product": {
"name": [
{
"value": "ClearSip Elegance"
}
]
},
"totalPrice": {
"priceExcludingTax": 58.473
}
}
],
"totals": {
"price": {
"priceExcludingTax": 218.47
}
}
}
}
}