How to create an order with the Admin API?


Hey!

At the moment I’m trying to post a order to a local Shopware 6 store, with my php application and using the Admin API.

To achieve this I’m using the following endpoint:
http://127.0.0.1/api/v3/order

This is the error I’m receiving:
{
„errors“: [
{
„code“: „0“,
„status“: „500“,
„title“: „Internal Server Error“,
„detail“: „Argument 1 passed to ShopwareCoreCheckoutCartPriceStructReferencePrice::__construct() must be of the type float, null given, called in /var/www/html/vendor/shopware/core/Framework/DataAbstractionLayer/FieldSerializer/CalculatedPriceFieldSerializer.php on line 73“
}
]
}

I cannot go into the code and fix this error in my Shopware 6 instance, because then my clients would have to do that as well.

Can I insert a order in a Shopware 6 store with the Admin API, if so could you tell me how?

Thanks in advance!

Please find my request body below:
{
„billingAddressId“: „3fa85f6457174562b3fc2c963f66afa6“,
„billingAddressVersionId“: „3fa85f6457174562b3fc2c963f66afa6“,
„currencyId“: „0dd28674b6ce471fbea53c7178d538ab“,
„languageId“: „0e469be3c1b648f598f0adddb517b79f“,
„salesChannelId“: „98432def39fc4624b33213a56b8c944d“,
„stateId“: „3fa85f6457174562b3fc2c963f66afa6“,
„orderDateTime“: „2021-04-28T20:13:51.176Z“,
„type“: „string“,
„id“: „3fa85f6457174562b3fc2c963f66afa6“,
„attributes“: {
„additionalProp1“: {}
},
„relationships“: {
„stateMachineState“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/stateMachineState“
},
„data“: {
„type“: „state_machine_state“,
„id“: „038e940c44da4b17b1d254deba448f84“
}
},
„orderCustomer“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/orderCustomer“
},
„data“: {
„type“: „order_customer“,
„id“: „800d42ebaea24d2497fd67d0adfd4240“
}
},
„currency“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/currency“
},
„data“: {
„type“: „currency“,
„id“: „1859cba627744ca789828271a04d0ef0“
}
},
„language“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/language“
},
„data“: {
„type“: „language“,
„id“: „07196ed0209f420091482f1aa4e35e9c“
}
},
„salesChannel“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/salesChannel“
},
„data“: {
„type“: „sales_channel“,
„id“: „ec6d3d4b39054eaf8fcdcf4231e0b583“
}
},
„addresses“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/addresses“
},
„data“: [
{
„type“: „order_address“,
„id“: „aad0921f637a474bb4803f13dc580321“
}
]
},
„deliveries“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/deliveries“
},
„data“: [
{
„type“: „order_delivery“,
„id“: „f2827017d2784b1d8e7206d731e2eec1“
}
]
},
„lineItems“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/lineItems“
},
„data“: [
{
„type“: „order_line_item“,
„id“: „8a05ae2d58314768822db96353bc57a4“
}
]
},
„transactions“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/transactions“
},
„data“: [
{
„type“: „order_transaction“,
„id“: „ccb57554dff54d8caa1b4f03b35d0f72“
}
]
},
„documents“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/documents“
},
„data“: [
{
„type“: „document“,
„id“: „c5e62f9ac2f74f24b5f5321753dd1ade“
}
]
},
„tags“: {
„links“: {
„related“: „/order/884e6f39e1db422fa0e7a07d09de761d/tags“
},
„data“: [
{
„type“: „tag“,
„id“: „ead585deebe248f28ac6dcdd65ff3c82“
}
]
}
},
„links“: {},
„meta“: {
„additionalProp1“: {}
},
„price“: {
„netPrice“: 0,
„totalPrice“: 0,
„calculatedTaxes“: {},
„taxRules“: {},
„positionPrice“: 0,
„taxStatus“: „string“
},
„shippingCosts“: {
„unitPrice“: 0,
„totalPrice“: 0,
„quantity“: 0,
„calculatedTaxes“: {},
„taxRules“: {},
„referencePrice“: {},
„listPrice“: {
„price“: 0,
„discount“: 0,
„percentage“: 0
}
},
„currencyFactor“: 0,
„deepLinkCode“: „string“,
„affiliateCode“: „string“,
„campaignCode“: „string“,
„customerComment“: „string“,

“customFields”: {}

}

6 Beiträge – 4 Teilnehmer

Vollständiges Thema lesen