I'm trying to create an invoice using the Magento REST API (/rest/default/V1/order/{orderId}/invoice) and I'm getting the following error:
"message": "\"%fieldName\" is not supported. Correct the field name and try again.",
"parameters": {
"fieldName": "AdditionalData"
}
Here's the payload I'm sending:
{
"appendComment": true,
"items": [
{
"order_item_id": 144,
"qty": 1.000000,
"additional_data": "{\"description\":\"HELLOOOOO\",\"um\":\"HELLOOOOO\"}"
}
]
}
I also tried passing the additional_data as an extension attribute, but I received the same error. Can someone help me figure out what I'm missing? Thanks in advance!
-
magecomp.com/blog/call-api-to-create-full-invoice-magento-2Ronak Rathod– Ronak Rathod2025年02月10日 05:20:20 +00:00Commented Feb 10 at 5:20
1 Answer 1
The Item do not have the additional_data
You can try it by code in your Custom module
- Create file
etc/extension_attributes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Sales\Api\Data\InvoiceItemCreationExtensionInterface">
<attribute code="additional_data" type="string" />
</extension_attributes>
</config>
- Run
bin\magento s:d:C
Then check
default